From 7c2fc7b32fbec3518b2b2b52f235071a4853a04f Mon Sep 17 00:00:00 2001
From: Geert Kapteijns <ghkapteijns@gmail.com>
Date: Sun, 15 Jan 2017 17:51:21 +0100
Subject: [PATCH] Subclass Comment from TimeStampedModel

---
 .../migrations/0006_auto_20170115_1750.py     | 27 +++++++++++++++++++
 comments/models.py                            |  6 ++---
 2 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 comments/migrations/0006_auto_20170115_1750.py

diff --git a/comments/migrations/0006_auto_20170115_1750.py b/comments/migrations/0006_auto_20170115_1750.py
new file mode 100644
index 000000000..9937694a1
--- /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 1e6c1c5d1..0c43a91ac 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)
-- 
GitLab