Compare commits
14 commits
737f073287
...
ae1ad6965f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae1ad6965f | ||
|
|
7319a738f4 | ||
|
|
640c75e499 | ||
|
|
dcd944b8c6 | ||
|
|
f782c58976 | ||
|
|
792f7517e3 | ||
|
|
faf880a236 | ||
|
|
7fbc81b9e1 | ||
|
|
3a73bb8887 | ||
|
|
74609215e0 | ||
|
|
1a5f1d5e81 | ||
|
|
d44b31f024 | ||
|
|
3d985e473d | ||
|
|
687445e414 |
1 changed files with 0 additions and 31 deletions
|
|
@ -1,31 +0,0 @@
|
|||
from django.db import migrations
|
||||
|
||||
|
||||
def regen_thumbnails(apps, schema_editor):
|
||||
Photo = apps.get_model("photologue", "Photo")
|
||||
PhotoSize = apps.get_model("photologue", "PhotoSize")
|
||||
|
||||
try:
|
||||
thumbnail = PhotoSize.objects.get(name="thumbnail")
|
||||
except PhotoSize.DoesNotExist:
|
||||
return
|
||||
|
||||
for photo in Photo.objects.all():
|
||||
# Use the real model instance to access file methods
|
||||
from photologue.models import Photo as RealPhoto
|
||||
try:
|
||||
real_photo = RealPhoto.objects.get(pk=photo.pk)
|
||||
real_photo.remove_size(thumbnail)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("photologue", "0008_photo_dimensions"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(regen_thumbnails, migrations.RunPython.noop),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue