39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
# Generated by Django 2.2.7 on 2019-12-18 14:37
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
def fill_publication_date_and_time(apps, schema_editor):
|
|
News = apps.get_model('news', 'News')
|
|
for news in News.objects.all():
|
|
if news.start is not None:
|
|
news.publication_date = news.start.date()
|
|
news.publication_time = news.start.time()
|
|
news.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('news', '0045_news_must_of_the_week'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='news',
|
|
name='publication_date',
|
|
field=models.DateField(blank=True, help_text='date since when news item is published', null=True, verbose_name='News publication date'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='news',
|
|
name='publication_time',
|
|
field=models.TimeField(blank=True, help_text='time since when news item is published', null=True, verbose_name='News publication time'),
|
|
),
|
|
migrations.AlterField(
|
|
model_name='news',
|
|
name='must_of_the_week',
|
|
field=models.BooleanField(default=False, verbose_name='Show in the carousel'),
|
|
),
|
|
migrations.RunPython(fill_publication_date_and_time, migrations.RunPython.noop),
|
|
]
|