from django.db import migrations def seed(apps, schema_editor): Page = apps.get_model('catalog', 'ManagedPage') rows = [ ('solterra-map', 'Explore Sol’Terra', '/map/', ''), ('about', 'Series introduction', '/about/', ''), ('chapters', 'Read', '/chapters/', 'read'), ('blog', 'Blog', '/blog/', 'blog'), ('reviews', 'Reviews', '/reviews/', 'reviews'), ('upcoming', 'Upcoming', '/upcoming/', 'upcoming'), ('live', 'SLX Live', '/live/', 'live'), ('cast', 'Cast', '/cast/', 'cast'), ('world', 'World archive', '/world/', 'world'), ('shop', 'Shop', '/shop/', 'shop'), ('cart', 'Shopping cart', '/shop/cart/', ''), ('newsletter', 'Newsletter', '/newsletter/', ''), ('membership', 'Membership', '/membership/', 'membership'), ('library', 'My library', '/fan/library/', 'library'), ('countdown', 'Release countdown', '/coming-soon/', ''), ('djinnii', 'Djinnii', '/djinnii/', ''), ('community', 'Community', '/community/', 'community'), ('search', 'Search', '/search/', 'search'), ] for slug, title, path, key in rows: Page.objects.using(schema_editor.connection.alias).get_or_create( slug=slug, defaults={'title':title, 'link':path, 'published':True, 'menu_key':key, 'map_slot':slug}) class Migration(migrations.Migration): dependencies = [('catalog','0027_alter_chapter_price_usd_managedpage')] operations = [migrations.RunPython(seed, migrations.RunPython.noop)]