delete the media folder and add image again from your admin



On Wednesday, July 22, 2020 at 3:56:35 AM UTC+1, Salima Begum wrote:
>
> Hi all,
> Here, i am using three image fields in PostAd form. Images are not saved 
> to the media folder. Can anyone help me please.
>
> In models.py
>
> class classifieds(models.Model):
>     title = models.CharField(max_length=60)
>     description = models.CharField(max_length=600)
>     price = models.IntegerField()
>     image = models.ImageField(upload_to='photo/', null=True, blank=True)
>     image2 = models.ImageField(upload_to='photo/', null=True, blank=True)
>     image3 = models.ImageField(upload_to='photo/', null=True, blank=True)
>     added_date = models.DateTimeField(editable=False)
>     modified_date = models.DateTimeField()
>
> In settings.py:
>
> MEDIA_ROOT = os.path.join(BASE_DIR,'media')
> MEDIA_URL = *'/media/'*
>
> In urls.py(project urls):
>
> urlpatterns += static(settings.MEDIA_URL,
> document_root=settings.MEDIA_ROOT)
>
> In views.py:
>
> snippet of views.py
>
> if request.method == 'POST':
>     title = request.POST['title']
>     description = request.POST['description']
>     price = request.POST['price']
>     image = request.POST['image']
>     image1 = request.POST['image1']
>     image2 = request.POST['image2']
>
> I am getting this error 
>
> Thanks in advance
>
>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/70cd5015-b614-4d58-9a94-3bfe5818630bo%40googlegroups.com.

Reply via email to