34 lines
948 B
Python
34 lines
948 B
Python
# Generated by Django 2.2.4 on 2019-09-23 12:55
|
|
|
|
from django.db import migrations
|
|
import django_extensions.db.fields
|
|
|
|
from establishment.models import Establishment
|
|
|
|
|
|
def migrate_data_forward(apps, schema_editor):
|
|
for instance in Establishment.objects.all():
|
|
print("Generating slug for %s" % instance)
|
|
instance.save() # Will trigger slug update
|
|
|
|
def migrate_data_backward(apps, schema_editor):
|
|
pass
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('establishment', '0028_auto_20190920_1205'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='establishment',
|
|
name='slug',
|
|
field=django_extensions.db.fields.AutoSlugField(blank=True, editable=True, populate_from=['name'], db_index=True, verbose_name='Establishment slug'),
|
|
),
|
|
migrations.RunPython(
|
|
migrate_data_forward,
|
|
migrate_data_backward,
|
|
),
|
|
]
|