bornhack-website/shop/migrations/0006_ensure_slugs.py

28 lines
645 B
Python
Raw Normal View History

2016-05-15 22:09:00 +00:00
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-15 16:15
from __future__ import unicode_literals
from django.db import migrations
def ensure_slugs(apps, schema_editor):
ProductCategory = apps.get_model('shop', 'ProductCategory')
Product = apps.get_model('shop', 'Product')
for category in ProductCategory.objects.all():
category.save()
for product in Product.objects.all():
product.save()
class Migration(migrations.Migration):
dependencies = [
('shop', '0005_product_slug'),
]
operations = [
migrations.RunPython(ensure_slugs, migrations.RunPython.noop)
]