Closed xtrinch closed 8 years ago
It could be that Django does some bulk update with TabularInline form, but I will have to investigate it in more detail. Is it possible that you can include relevant code snippets, it would be very helpful.
class Photo(models.Model):
rating = models.ForeignKey(Rating)
photo = fields.ImageField(upload_to='static/photos', null=True, dependencies=[
FileDependency(processor=ImageProcessor(
format='JPEG', scale={'max_width': 300, 'max_height': 300}))
])
class PhotoInline(admin.TabularInline):
model = Photo
extra = 0
class RatingAdmin(admin.ModelAdmin):
list_display = ('id','rating_date','token_user', 'token_shop', 'rating')
inlines = [
PhotoInline
]
@xtrinch, thank you. I'll look into the problem this weekend.
I'm fairly certain inlines don't trigger any bulk ORM actions (which would bypass smartfields)
@andybak, yes bulk ORM actions would definitely bypass smartfields, and yes inlines don't trigger any actions.
@xtrinch, unfortunately I cannot replicate your problem. I've created same models and used same code for admin. Attached is the screenshot. Images are converted and resized as expected (notice .jpg extension, I was uploading .png's) What's the version of Django you are using and version of Pillow library? Does it resize images when you upload using regular forms?
@xtrinch, as a side note and unrelated to this issue, you shouldn't use null=True
on file fields, use blank=True
instead, since as far as database is concerned it is simple VARCHAR
field.
https://docs.djangoproject.com/en/1.9/ref/models/fields/#null
I guess I am closing the issue since it cannot be replicated.
The images are not processed (resized) when uploaded through the django TabularInline form.