fix migration
This commit is contained in:
parent
cd951ddd75
commit
46ce25f0f7
|
|
@ -1,11 +1,12 @@
|
||||||
# Generated by Django 2.2.4 on 2019-09-27 08:45
|
# Generated by Django 2.2.4 on 2019-09-27 08:45
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
from django.core.validators import EMPTY_VALUES
|
||||||
|
|
||||||
|
|
||||||
def fill_slug(apps,schemaeditor):
|
def fill_slug(apps,schemaeditor):
|
||||||
News = apps.get_model('news', 'News')
|
News = apps.get_model('news', 'News')
|
||||||
for news in News.objects.all():
|
for news in News.objects.all():
|
||||||
if news.slug is None:
|
if news.slug in EMPTY_VALUES:
|
||||||
news.slug = f'Slug_{news.id}'
|
news.slug = f'Slug_{news.id}'
|
||||||
news.save()
|
news.save()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user