gault-millau/apps/news/migrations/0043_auto_20191216_1920.py
2019-12-16 23:16:19 +03:00

38 lines
1.3 KiB
Python

# Generated by Django 2.2.7 on 2019-12-16 19:20
import django.contrib.postgres.fields.hstore
from django.db import migrations, models
import uuid
def fill_uuid(apps, schemaeditor):
News = apps.get_model('news', 'News')
for news in News.objects.all():
news.duplication_uuid = uuid.uuid4()
news.save()
class Migration(migrations.Migration):
dependencies = [
('news', '0042_news_duplication_date'),
]
operations = [
migrations.AddField(
model_name='news',
name='description_to_locale_is_active',
field=django.contrib.postgres.fields.hstore.HStoreField(blank=True, default=dict, help_text='{"en-GB": true, "fr-FR": false}', null=True, verbose_name='Is description for certain locale active'),
),
migrations.AddField(
model_name='news',
name='duplication_uuid',
field=models.UUIDField(default=uuid.uuid4, verbose_name='Field to detect doubles'),
),
migrations.AlterField(
model_name='news',
name='slugs',
field=django.contrib.postgres.fields.hstore.HStoreField(blank=True, default=dict, help_text='{"en-GB":"some slug"}', null=True, verbose_name='Slugs for current news obj'),
),
migrations.RunPython(fill_uuid, migrations.RunPython.noop),
]