Use timezones everywhere in migrations

This commit is contained in:
Martin Pépin 2017-02-23 18:33:44 +01:00
parent 0e4cfc5121
commit 1663a03a33
4 changed files with 16 additions and 8 deletions

View file

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.db import models, migrations from django.db import models, migrations
import django.db.models.deletion import django.db.models.deletion
import django.core.validators import django.core.validators
import datetime from django.utils import timezone
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -31,7 +31,7 @@ class Migration(migrations.Migration):
name='AccountNegative', name='AccountNegative',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('start', models.DateTimeField(default=datetime.datetime(2016, 8, 2, 10, 22, 1, 569492))), ('start', models.DateTimeField(default=timezone.datetime(2016, 8, 2, 10, 22, 1, 569492, tzinfo=timezone.get_default_timezone()))),
('balance_offset', models.DecimalField(decimal_places=2, max_digits=6)), ('balance_offset', models.DecimalField(decimal_places=2, max_digits=6)),
('authorized_overdraft', models.DecimalField(decimal_places=2, default=0, max_digits=6)), ('authorized_overdraft', models.DecimalField(decimal_places=2, default=0, max_digits=6)),
('comment', models.CharField(max_length=255, blank=True)), ('comment', models.CharField(max_length=255, blank=True)),

View file

@ -2,7 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import models, migrations
import datetime from django.utils import timezone
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -19,6 +19,11 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='accountnegative', model_name='accountnegative',
name='start', name='start',
field=models.DateTimeField(default=datetime.datetime(2016, 8, 2, 21, 39, 30, 52279)), field=models.DateTimeField(
default=timezone.datetime(
2016, 8, 2, 21, 39, 30, 52279,
tzinfo=timezone.get_default_timezone()
)
),
), ),
] ]

View file

@ -2,7 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import models, migrations
import datetime from django.utils import timezone
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -15,6 +15,6 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='accountnegative', model_name='accountnegative',
name='start', name='start',
field=models.DateTimeField(default=datetime.datetime.now), field=models.DateTimeField(default=timezone.now),
), ),
] ]

View file

@ -2,7 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import models, migrations
import datetime from django.utils import timezone
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -15,6 +15,9 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='accountnegative', model_name='accountnegative',
name='start', name='start',
field=models.DateTimeField(default=datetime.datetime.now, blank=True, null=True), field=models.DateTimeField(
default=timezone.now,
blank=True, null=True
),
), ),
] ]