diff --git a/apps/map/migrations/0068_casestudydraft_created.py b/apps/map/migrations/0068_casestudydraft_created.py new file mode 100644 index 0000000..1310746 --- /dev/null +++ b/apps/map/migrations/0068_casestudydraft_created.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2018-05-30 02:52 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('map', '0067_remove_old_images'), + ] + + operations = [ + migrations.AddField( + model_name='casestudydraft', + name='created', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + ] diff --git a/apps/map/models.py b/apps/map/models.py index 5a6eb2e..9cfaaa2 100644 --- a/apps/map/models.py +++ b/apps/map/models.py @@ -20,8 +20,13 @@ class CaseStudyDraft(models.Model): User, on_delete=models.CASCADE ) + created = models.DateTimeField(auto_now_add=True) + data = models.TextField() + def __str__(self): + return "{0.author.username}, {0.created:%Y-%m-%d %H:%M}".format(self) + class SpatialRefSys(connection.ops.spatial_ref_sys()): def __str__(self):