thanks

On Monday, July 11, 2016 at 11:16:27 AM UTC+3, Mstislav Kazakov wrote:
>
> Try to override `delete` method in your model. You should do something 
> like this:
>
> class Example(models.Model):
>     f = models.FileField(null=True, blank =True)   
>
>
>     def delete(self,*args,**kwargs):
>         if os.path.isfile(self.f.path):
>             os.remove(self.f.path)
>
>         super(Example, self).delete(*args,**kwargs)
>
>
> 2016-07-09 21:04 GMT+05:00 <[email protected] <javascript:>>:
>
>> This way the Image is removed from database, not from the server.
>>
>> On Friday, July 8, 2016 at 6:41:57 PM UTC+3, Mstislav Kazakov wrote:
>>>
>>> Just pass empty value in file field.
>>> If blank=True and null=True, everything should work fine and image will 
>>> be removed.
>>>
>>> пятница, 8 июля 2016 г., 17:23:42 UTC+5 пользователь [email protected] 
>>> написал:
>>>>
>>>> The user has the possibility to add/delete image and documents.
>>>>
>>>>
>>>> I used GCBV UpdateView and a FormModel for this. 
>>>>
>>>>
>>>> How can I offer the possibility to the user to delete the file/image ?
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/bdd2edd2-d232-416e-9ff4-b5b3519e6c1e%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/bdd2edd2-d232-416e-9ff4-b5b3519e6c1e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c672d36c-8c89-4b7c-94e2-64e7da28d014%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to