diff --git a/comments/migrations/0006_auto_20170115_1750.py b/comments/migrations/0006_auto_20170115_1750.py new file mode 100644 index 0000000000000000000000000000000000000000..9937694a13ff6a56d62b3a8a7d7da23a9331107b --- /dev/null +++ b/comments/migrations/0006_auto_20170115_1750.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-01-15 16:50 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('comments', '0005_merge_20161219_2126'), + ] + + operations = [ + migrations.AddField( + model_name='comment', + name='created', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AddField( + model_name='comment', + name='latest_activity', + field=models.DateTimeField(auto_now=True), + ), + ] diff --git a/comments/models.py b/comments/models.py index 1e6c1c5d1da23a916f201a3e664b24e001ab0d7d..0c43a91ac3751dcd52e860481d7fca09dc30f12d 100644 --- a/comments/models.py +++ b/comments/models.py @@ -8,7 +8,7 @@ from django.utils.safestring import mark_safe from .models import * from commentaries.models import Commentary -from scipost.models import Contributor +from scipost.models import TimeStampedModel, Contributor from submissions.models import Submission, Report from theses.models import ThesisLink @@ -34,7 +34,7 @@ COMMENT_STATUS = ( comment_status_dict = dict(COMMENT_STATUS) -class Comment(models.Model): +class Comment(TimeStampedModel): """ A Comment is an unsollicited note, submitted by a Contributor, on a particular publication or in reply to an earlier Comment. """ @@ -42,7 +42,7 @@ class Comment(models.Model): vetted_by = models.ForeignKey(Contributor, blank=True, null=True, on_delete=models.CASCADE, related_name='comment_vetted_by') - # a Comment is either for a Commentary or Submission + # a Comment is either for a Commentary or Submission or a ThesisLink. commentary = models.ForeignKey(Commentary, blank=True, null=True, on_delete=models.CASCADE) submission = models.ForeignKey(Submission, blank=True, null=True, on_delete=models.CASCADE) thesislink = models.ForeignKey(ThesisLink, blank=True, null=True, on_delete=models.CASCADE)