camp/content/migrations/0014_migrate_shortname.py

24 lines
556 B
Python
Raw Permalink Normal View History

2018-08-22 19:59:40 +00:00
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-08-22 19:08
from __future__ import unicode_literals
from django.db import migrations
def migrate_shortname(apps, schema_editor):
Content = apps.get_model("content", "Content")
for c in Content.objects.filter(shortname__contains=' '):
c.shortname = c.shortname.replace(' ', '_')
c.save()
class Migration(migrations.Migration):
dependencies = [
('content', '0013_related'),
]
operations = [
migrations.RunPython(migrate_shortname),
]