created_at required with default

This commit is contained in:
Aurélien Delobelle 2017-04-06 00:31:04 +02:00
parent e2d7192b23
commit 4b2e20e728
2 changed files with 21 additions and 1 deletions

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('kfet', '0052_category_addcost'),
]
operations = [
migrations.AlterField(
model_name='account',
name='created_at',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]

View file

@ -41,7 +41,7 @@ class Account(models.Model):
max_digits = 6, decimal_places = 2,
default = 0)
is_frozen = models.BooleanField("est gelé", default = False)
created_at = models.DateTimeField(auto_now_add = True, null = True)
created_at = models.DateTimeField(default=timezone.now)
# Optional
PROMO_CHOICES = [(r,r) for r in range(1980, date.today().year+1)]
promo = models.IntegerField(