top align in tables
[redakcja.git] / apps / catalogue / models / publish_log.py
1 # -*- coding: utf-8 -*-
2 #
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.
5 #
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
10
11
12 class BookPublishRecord(models.Model):
13     """
14         A record left after publishing a Book.
15     """
16
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'))
20
21     class Meta:
22         app_label = 'catalogue'
23         ordering = ['-timestamp']
24         verbose_name = _('book publish record')
25         verbose_name_plural = _('book publish records')
26
27
28 class ChunkPublishRecord(models.Model):
29     """
30         BookPublishRecord details for each Chunk.
31     """
32
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'))
35
36     class Meta:
37         app_label = 'catalogue'
38         verbose_name = _('chunk publish record')
39         verbose_name_plural = _('chunk publish records')
40
41
42 class ImagePublishRecord(models.Model):
43     """A record left after publishing an Image."""
44
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'))
49
50     class Meta:
51         app_label = 'catalogue'
52         ordering = ['-timestamp']
53         verbose_name = _('image publish record')
54         verbose_name_plural = _('image publish records')