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):
>
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,
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:2
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 пользователь sevenr...@gmail.com
написал:
>
> The user has the possibility to add/delete image and documents.
>
>
> I used GCBV UpdateV
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 un
5 matches
Mail list logo