pep8, style, dead code cleanup etc.
[redakcja.git] / apps / catalogue / models / publish_log.py
index f422e37..2dfff9e 100755 (executable)
@@ -1,39 +1,23 @@
 # -*- coding: utf-8 -*-
 #
-# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
+# This file is part of MIL/PEER, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.contrib.auth.models import User
+from django.conf import settings
 from django.db import models
 from django.utils.translation import ugettext_lazy as _
-from catalogue.models import Chunk
+from dvcs.models import Revision
 
 
-class BookPublishRecord(models.Model):
-    """
-        A record left after publishing a Book.
-    """
+class PublishRecord(models.Model):
+    """A record left after publishing a Document."""
 
-    book = models.ForeignKey('Book', verbose_name=_('book'), related_name='publish_log')
+    document = models.ForeignKey('catalogue.Document', verbose_name=_('document'), related_name='publish_log')
+    revision = models.ForeignKey(Revision, verbose_name=_('revision'), related_name='publish_log')
     timestamp = models.DateTimeField(_('time'), auto_now_add=True)
-    user = models.ForeignKey(User, verbose_name=_('user'))
+    user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('user'))
 
     class Meta:
-        app_label = 'catalogue'
         ordering = ['-timestamp']
         verbose_name = _('book publish record')
-        verbose_name = _('book publish records')
-
-
-class ChunkPublishRecord(models.Model):
-    """
-        BookPublishRecord details for each Chunk.
-    """
-
-    book_record = models.ForeignKey(BookPublishRecord, verbose_name=_('book publish record'))
-    change = models.ForeignKey(Chunk.change_model, related_name='publish_log', verbose_name=_('change'))
-
-    class Meta:
-        app_label = 'catalogue'
-        verbose_name = _('chunk publish record')
-        verbose_name = _('chunk publish records')
+        verbose_name_plural = _('book publish records')