You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, sorry if this repo is not related to width/height assignation to the model. I'm not well professional with django. If so, please redirect me to repository responsible for that.
I already create related issue in the django-rest-framework repository here
Because this issue i can reproduce only with rest-framework. With default admin POST form is not exist.
When i do POST request as form-date with imageField, the image successfully uploaded, but photo_width and photo_height are not being populated.
CommentPhotoRel is extends Photo model, which is NON-abstract.
I use non-abstract parent to keep ability go through all photos.
If i switch this class to abstract issue will not reproduced and width/heigth will passed correctly.
Go to http://localhost:8000/upload/ and upload any image to model. Width and height will be 0.
Make Photo class abstract = True and repeat uploading. Width and height will be populated as expect.
The text was updated successfully, but these errors were encountered:
roman-rr
changed the title
ImageField not populate width/height attributes for child class model
ImageField not populated width/height for child model
Aug 19, 2021
In the example code I can't see anything related to ImageKit. Just pure Django (at least for the models). Can you try to reroduce this but using simple Django model forms instead of using Django REST Framework? It's very strange that the save method is called so many times in the admin.
Also can you share with us the REST framework view responsible for the /upload/ endpoint and everything REST framework specific.
Hello @vstoykov
I can reproduce only with Django REST Framework or with REST request from postman (to Django REST endpoint).
Only when parent class is not abstract.
In repo the minimal code to reproduce issue.
NOTE:
What i personally found:
Dimensions assigned in ImageFileDescriptor setter.
Setter __set__ from ImageFileDescriptor function executed only once when POST with Django REST, right after model execute .save() method.
When create object from django admin, this setter executed few times before .save() method.
Yes, maybe is not directly to this repo, more to Django + Django REST in pair. But i will appreciate any thoughts.
First of all, sorry if this repo is not related to width/height assignation to the model. I'm not well professional with django. If so, please redirect me to repository responsible for that.
I already create related issue in the django-rest-framework repository here
Because this issue i can reproduce only with rest-framework. With default admin POST form is not exist.
When i do POST request as form-date with
imageField
, the image successfully uploaded, butphoto_width
andphoto_height
are not being populated.This is my models:
CommentPhotoRel is extends Photo model, which is NON-abstract.
I use non-abstract parent to keep ability go through all photos.
If i switch this class to abstract issue will not reproduced and width/heigth will passed correctly.
Steps to reproduce
http://localhost:8000/upload/
and upload any image to model. Width and height will be 0.The text was updated successfully, but these errors were encountered: