'How to make Django using Pillow to crop only new image in Admin panel's change form?
I can make Django crop images, but I got a problem. When I go to change form in admin panel to update one of the images, all images got cropped again and again after every new save - which means all images get smaller and smaller. How to make Django only crop new images and leave old images alone?
Each of my images got a crop count field - when set to 0 the image could be cropped and if set to 1 the image could not be cropped. Each image also got a created_date field which automatically generated a timestamp.
Can any of these extra fields be used to create a condition in which an image won't get cropped twice when a product got updated?
Example: product 1 has image_1, image_2, image_3, -- image_1 got crop_count and created_date fields, same goes for all other images. -- I want is to go to image_1 to update it with a newer image, and I don't want to see image_2 and image_3 got cropped - but only image_1 gets cropped. How?
I know how to use signal in Django, so should this be post-save or pre-save?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
