1 # -*- coding: utf-8 -*-
3 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6 from django.contrib.auth.models import User
7 from django.db import models
8 from django.utils.translation import ugettext_lazy as _
9 from catalogue.models import Chunk, Image
12 class BookPublishRecord(models.Model):
14 A record left after publishing a Book.
17 book = models.ForeignKey('Book', verbose_name=_('book'), related_name='publish_log')
18 timestamp = models.DateTimeField(_('time'), auto_now_add=True)
19 user = models.ForeignKey(User, verbose_name=_('user'))
22 app_label = 'catalogue'
23 ordering = ['-timestamp']
24 verbose_name = _('book publish record')
25 verbose_name_plural = _('book publish records')
28 class ChunkPublishRecord(models.Model):
30 BookPublishRecord details for each Chunk.
33 book_record = models.ForeignKey(BookPublishRecord, verbose_name=_('book publish record'))
34 change = models.ForeignKey(Chunk.change_model, related_name='publish_log', verbose_name=_('change'))
37 app_label = 'catalogue'
38 verbose_name = _('chunk publish record')
39 verbose_name_plural = _('chunk publish records')
42 class ImagePublishRecord(models.Model):
43 """A record left after publishing an Image."""
45 image = models.ForeignKey(Image, verbose_name=_('image'), related_name='publish_log')
46 timestamp = models.DateTimeField(_('time'), auto_now_add=True)
47 user = models.ForeignKey(User, verbose_name=_('user'))
48 change = models.ForeignKey(Image.change_model, related_name='publish_log', verbose_name=_('change'))
51 app_label = 'catalogue'
52 ordering = ['-timestamp']
53 verbose_name = _('image publish record')
54 verbose_name_plural = _('image publish records')