Re: delete image url from database

2019-10-16 Thread Nuno Vieira
I am saving the image to media folder and save the url in database. photo_5 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True) Then when the user clicks in trash can icon, i have an ajax request to delete the image from database. But there is the problem, i am not able to update the

Re: delete image url from database

2019-10-16 Thread Anirudh Jain
First of all, are you saving image url explicitly in database ? You dont need to so that to show/delete any image. Second, try delete() for deletint image entry. On Wed, 16 Oct 2019, 19:54 Nuno Vieira, wrote: > Hi there, > > i am creating a real estate app and i want users to insert and delete

delete image url from database

2019-10-16 Thread Nuno Vieira
Hi there, i am creating a real estate app and i want users to insert and delete images for the houses. It's all working great except the delete. In my views.py i have the code: listing = Listing.objects.get(id=1511) if listing: listing.photo_5 = None