Skip to content

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

Add migration from markdown to html

dominik-zeglen03c379904f6f
diff --git a/saleor/product/migrations/0045_md_to_html.py b/saleor/product/migrations/0045_md_to_html.py
new file mode 100644
index 0000000000..ac8b2831a5
--- /dev/null
+++ b/saleor/product/migrations/0045_md_to_html.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.9 on 2018-01-15 11:16
+from __future__ import unicode_literals
+
+from django.db import migrations
+from markdown import markdown
+
+
+def md_to_html(apps, schema_editor):
+ Product = apps.get_model('product', 'Product')
+ for product in Product.objects.all():
+ product.description = markdown(product.description)
+ product.save()
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ('product', '0044_auto_20180108_0814'),
+ ]
+
+ operations = [
+ migrations.RunPython(md_to_html),
+ ]