Showing <animacja>.
[redakcja.git] / src / catalogue / models / publish_log.py
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.
3 #
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 catalogue.models import Chunk, Image
8
9
10 class BookPublishRecord(models.Model):
11     """
12         A record left after publishing a Book.
13     """
14
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'))
18
19     class Meta:
20         app_label = 'catalogue'
21         ordering = ['-timestamp']
22         verbose_name = _('book publish record')
23         verbose_name_plural = _('book publish records')
24
25
26 class ChunkPublishRecord(models.Model):
27     """
28         BookPublishRecord details for each Chunk.
29     """
30
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'))
33
34     class Meta:
35         app_label = 'catalogue'
36         verbose_name = _('chunk publish record')
37         verbose_name_plural = _('chunk publish records')
38
39
40 class ImagePublishRecord(models.Model):
41     """A record left after publishing an Image."""
42
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'))
47
48     class Meta:
49         app_label = 'catalogue'
50         ordering = ['-timestamp']
51         verbose_name = _('image publish record')
52         verbose_name_plural = _('image publish records')