1 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django.contrib.auth.models import User
5 from django.db import models
6 from django.utils.translation import ugettext_lazy as _
7 from documents.models import Chunk, Image
10 class BookPublishRecord(models.Model):
12 A record left after publishing a Book.
15 book = models.ForeignKey('Book', models.CASCADE, verbose_name=_('book'), related_name='publish_log')
16 timestamp = models.DateTimeField(_('time'), auto_now_add=True)
17 user = models.ForeignKey(User, models.CASCADE, verbose_name=_('user'))
20 app_label = 'documents'
21 ordering = ['-timestamp']
22 verbose_name = _('book publish record')
23 verbose_name_plural = _('book publish records')
26 class ChunkPublishRecord(models.Model):
28 BookPublishRecord details for each Chunk.
31 book_record = models.ForeignKey(BookPublishRecord, models.CASCADE, verbose_name=_('book publish record'))
32 change = models.ForeignKey(Chunk.change_model, models.CASCADE, related_name='publish_log', verbose_name=_('change'))
35 app_label = 'documents'
36 verbose_name = _('chunk publish record')
37 verbose_name_plural = _('chunk publish records')
40 class ImagePublishRecord(models.Model):
41 """A record left after publishing an Image."""
43 image = models.ForeignKey(Image, models.CASCADE, verbose_name=_('image'), related_name='publish_log')
44 timestamp = models.DateTimeField(_('time'), auto_now_add=True)
45 user = models.ForeignKey(User, models.CASCADE, verbose_name=_('user'))
46 change = models.ForeignKey(Image.change_model, models.CASCADE, related_name='publish_log', verbose_name=_('change'))
49 app_label = 'documents'
50 ordering = ['-timestamp']
51 verbose_name = _('image publish record')
52 verbose_name_plural = _('image publish records')