-
Create an object with ImageField within REST API are not automatically populated values into I dig deeper issue and found following things. Currently i solve this issue with hack: class Photo(models.Model):
photo = models.ImageField(
height_field='photo_height',
width_field='photo_width',
)
class Meta:
ordering = ('-created_at',)
def save(self, *args, **kwargs):
# add additional setter call before save model to re-assign width/height into our fields
self.photo = self.photo
return super(CommentPhotoRel, self).save(*args, **kwargs) But i believe that there are some reasons, setter called only one time after save, rather than admin model creation, where setter called few times before save. Any thoughts ? Checklist
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey @tomchristie |
Beta Was this translation helpful? Give feedback.
-
@tomchristie I found that issue is reproduced only if the image model inherit parent NOT abstract model. In other cases is all fine. Will try to talk with imagekit team. Can be closed as discussion. |
Beta Was this translation helpful? Give feedback.
@tomchristie I found that issue is reproduced only if the image model inherit parent NOT abstract model. In other cases is all fine. Will try to talk with imagekit team. Can be closed as discussion.