Add CaseStudyDraft.created

This commit is contained in:
Carl van Tonder 2018-05-29 23:15:39 -04:00
parent 39949562c1
commit d80f933b7b
2 changed files with 27 additions and 0 deletions

View File

@ -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,
),
]

View File

@ -20,8 +20,13 @@ class CaseStudyDraft(models.Model):
User, on_delete=models.CASCADE User, on_delete=models.CASCADE
) )
created = models.DateTimeField(auto_now_add=True)
data = models.TextField() 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()): class SpatialRefSys(connection.ops.spatial_ref_sys()):
def __str__(self): def __str__(self):