Re: managing files, deleting file from file system with admin site
I think you need to do this with a signal, or on post_save
On Thu, Nov 15, 2012 at 12:48 AM, Sergey Seleznev <artofvs@gmail.com> wrote:
> Hi! I'm new to python and django(well, and web dev too).
> I'm using python 2.7 and django 1.4
> I went through the tutorial and then got issue with files managing.
> I have model like this:
>
> class Car(models.Model):
> #some fields
> photo = models.ImageField(upload_to='cars')
>
> and media url/root configured in settings.py.
> Also I have autogenerated django admin site.
> Its works well and I can upload files to MEDIA_ROOT/cars/ automaticaly when
> adding new object to Car model, but when I delete or change that object from
> admin site old file doesnt deletes.
> I need some easy and a good way to configure model/admin_site/something_else
> to delete old files from file system when i change/delete model object from
> admin site.
> I think admin actions can be solution, but dont think it helps in case of
> changes and it cant help override "Delete" button from object edit page.
>
> Thanks for your help!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/86NC9uiQ4uAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home