1 # Generated by Django 2.2.19 on 2021-06-01 10:58
4 from django.db import migrations
7 def ints_to_dates(apps, schema_editor):
8 Visits = apps.get_model('stats', 'Visits')
9 for visit in Visits.objects.all():
10 visit.date = datetime.date(visit.year, visit.month, 1)
13 def dates_to_ints(apps, schema_editor):
14 Visits = apps.get_model('stats', 'Visits')
15 for visit in Visits.objects.all():
16 visit.year = visit.date.year
17 visit.month = visit.date.month
21 class Migration(migrations.Migration):
24 ('stats', '0002_visits_date'),
28 migrations.RunPython(ints_to_dates, dates_to_ints)