Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove thumbnail generation from migration

Krzysztof Świątek72e7c3a81930
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f264a99a7..c2197985e2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,9 @@ All notable, unreleased changes to this project will be documented in this file.
- Query object translation with only manage_translation permission - #4914 by @fowczarek
- Add customer note to draft orders api - #4973 by @IKarbowiak
- Allow to delete category and leave products - #4970 by @IKarbowiak
+- Add cutomer note to draft orders api - #4973 by @IKarbowiak
+- Remove thumbnail generation from migration - #3494 by @kswiatek92
+
## 2.9.0
diff --git a/saleor/product/migrations/0077_generate_versatile_background_images.py b/saleor/product/migrations/0077_generate_versatile_background_images.py
index 4f527fea5d..2eb3b6c54f 100644
--- a/saleor/product/migrations/0077_generate_versatile_background_images.py
+++ b/saleor/product/migrations/0077_generate_versatile_background_images.py
@@ -1,40 +1,10 @@
# Generated by Django 2.1.2 on 2018-11-11 16:08
-from sys import stderr
-
-from django.db import migrations, models
-from versatileimagefield.image_warmer import VersatileImageFieldWarmer
-
-
-def log_failed_images(failed_to_create):
- if failed_to_create:
- print("Failed to generate thumbnails:", file=stderr)
- for path in failed_to_create:
- print(path, file=stderr)
-
-
-def warm_model_background_images(model: models.Model):
- warmer = VersatileImageFieldWarmer(
- instance_or_queryset=model.objects.all(),
- rendition_key_set="background_images",
- image_attr="background_image",
- verbose=True,
- )
- num_created, failed_to_create = warmer.warm()
- log_failed_images(failed_to_create)
-
-
-def warm_background_images(apps, *_):
- Category = apps.get_model("product", "Category")
- print("Generating thumbnails for Categories", file=stderr)
- warm_model_background_images(Category)
-
- Collection = apps.get_model("product", "Collection")
- print("Generating thumbnails for Collections", file=stderr)
- warm_model_background_images(Collection)
+from django.db import migrations
class Migration(migrations.Migration):
-
+ # there was 'thumbnail generation' which already exists ad management command
+ # because this migration is depended on, it cannot be removed
dependencies = [("product", "0076_auto_20181012_1146")]
- operations = [migrations.RunPython(warm_background_images)]
+ operations = []