diff --git a/commentaries/migrations/0013_auto_20161213_2328.py b/commentaries/migrations/0013_auto_20161213_2328.py new file mode 100644 index 0000000000000000000000000000000000000000..ec27da0367e4f87026cfc64b8131232f62bfb3cc --- /dev/null +++ b/commentaries/migrations/0013_auto_20161213_2328.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-12-13 22:28 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('commentaries', '0012_remove_commentary_specialization'), + ] + + operations = [ + migrations.AddField( + model_name='commentary', + name='created', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AlterField( + model_name='commentary', + name='latest_activity', + field=models.DateTimeField(auto_now=True), + ), + ] diff --git a/commentaries/models.py b/commentaries/models.py index c216ce3599e806f4ec35c2925dcb8d49c7b3caf2..b7b570150cc95fc6efaad4cfa7c646a48f9cfb07 100644 --- a/commentaries/models.py +++ b/commentaries/models.py @@ -5,7 +5,7 @@ from django.contrib.postgres.fields import JSONField from django.template import Template, Context from journals.models import SCIPOST_JOURNALS_DOMAINS, SCIPOST_JOURNALS_SPECIALIZATIONS -from scipost.models import Contributor +from scipost.models import TimeStampedModel, Contributor from scipost.models import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS @@ -15,7 +15,7 @@ COMMENTARY_TYPES = ( ('preprint', 'arXiv preprint'), ) -class Commentary(models.Model): +class Commentary(TimeStampedModel): """ A Commentary contains all the contents of a SciPost Commentary page for a given publication. """ @@ -55,7 +55,6 @@ class Commentary(models.Model): pages = models.CharField(max_length=50, blank=True, null=True) pub_date = models.DateField(verbose_name='date of original publication', blank=True, null=True) pub_abstract = models.TextField(verbose_name='abstract') - latest_activity = models.DateTimeField(default=timezone.now) class Meta: verbose_name_plural = 'Commentaries'