Questions tagged [imagefield]

A place to store or display a graphic image.

"Image field" is a generic term that typically would belong in a or setting such as:

It appears to be a synonym for .

342 questions
0
votes
0 answers

Image not displaying in browser from Django project

I am trying out an ecommerce website where list of products are input in the admin section, everything works well aside the fact that the product image does not display in browser. Have check all the codes and everything seems ok. Displaying this…
0
votes
1 answer

ImageField gets None value after overriding create method

I am trying to create a user, I need to override the create method, but after that, imagefield gets null value instead of given file here is my code views.py class VerifyEmail(CreateAPIView): serializer_class = UserSerializer queryset =…
0
votes
0 answers

How to pass an optional image through my django, by accepting from views.py

I want to accept an optional image from the user and pass it via my form, but it keeps popping up with multivaluedictkeyerror (i have added the enctype = "multipart/form-data") ps. im new to django this is my views.py def notes(request): if…
0
votes
0 answers

Why can't I add a photo in the Django admin panel: Upload a valid image error

I'm making a Django store site and I have a product class that includes an "image" field. I am using Models.ImageField and Pillow and when adding pictures the admin panel gives an error. Error message: "Upload a valid image. The file you uploaded…
Юрий
  • 1
  • 1
0
votes
0 answers

Forbidden: / 403 error while sending image from react to django using axios

I have a reactjs project that makes requests using API to django-rest-framework. I am trying to create an image field in reactJS that sends image to django server on submitting. Maybe the error is with csrf token or maybe not. I am a newbie. Please…
jen
  • 11
  • 1
0
votes
1 answer

Problems when trying to save an image from react-native to a django model

I am writing my first react-native app with a django backend. for my app to work properly I need to send an image from the device's image library to the django server and then save it in the model. here's my code - react-native- const sendI = async…
0
votes
1 answer

How to avoid path duplication of images downloaded to database with django form

I have a problem with django ImageField. To be precise, with its download path and saving to database. I`ve set upload_to to the directory needed, and it saves files right where it should be. photo = models.ImageField( …
0
votes
1 answer

Django do not update ImageField

Why Django update() do not update image file in media folder, but update everything else in update process.. Old image is in media folder, but there is no new image in folder.. When creating (using save()) everything is fine.. Any help, thanks in…
DevJava
  • 5
  • 2
0
votes
1 answer

Sending Image from React-Native app to Django Models

I am building a react-native app with a Django backend. I am trying to send a user input image to Django to be saved as an ImageField in Django Models without using REST-FRAMEWORK. How can I do that?
Itay Lador
  • 313
  • 1
  • 10
0
votes
1 answer

How do I detect if my user has uploaded an ImageField or FileField?

I have the following model and function to set the upload paths for either image files or other files (which will be audio files). def upload_to(instance, filename): # Check for image or sound file and put in appropriate directory if…
ragmats
  • 91
  • 8
0
votes
0 answers

How can i change file directory's name related to an instance's field too after the field get updated in Django's model

good day everyone, i am a self learner and quite new to django and i am facing some questions currently, i created a model which will have images upload to a self-defined directory as like this: class OverwriteStorage(FileSystemStorage): def…
0
votes
1 answer

Why should I only allow image upload during DEBUG mode?

I want to add a field for users to edit their profile pictures and checked out a few tutorials. However, every tutorial I've found included some form of this in urls.py: if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, …
Ethan
  • 19
  • 2
0
votes
1 answer

Django ImageField is not being updated while submiting a form

Issue describrion I have a model which describes a UserProfile and a dedicated form to allow user to update the model. Except photo(ImageField), everything is working fine. Issue with photo field is that the image is not being changed at all with…
Seb
  • 3
  • 2
0
votes
0 answers

Creating an image field in Django Python, 2022

I'm learning programming (beginner level), and am currently working on a web app project in Python/Django. I would like to add an image field to my models, but the tutorials I find don't seem to work. Does anyone have simple, comprehensive steps to…
pol_v
  • 1
0
votes
1 answer

getting thumbnail from original image without inputting that thumbnail image manually || Django Rest Framework

I have found an issue in a project with Django REST Framework. Where in 'POST', I'll input only 1 image file but in 'GET', I will get the file path of that image file as well as I'll get another file path of resized version of that image. In models,…