add created_at and updated_at fields

This commit is contained in:
Fred Pauchet 2017-10-26 17:02:58 +02:00
parent 0f2e88374e
commit 86538ce3c8
3 changed files with 30 additions and 1 deletions

Binary file not shown.

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-26 13:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('evolus', '0007_keyword_parent'),
]
operations = [
migrations.AddField(
model_name='keyword',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='keyword',
name='updated_at',
field=models.DateTimeField(auto_now=True),
),
]

View File

@ -95,7 +95,9 @@ class Keyword(ClosureModel):
name = models.CharField(max_length=255)
parent = models.ForeignKey('self', null=True, blank=True)
selectable = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return self.name