Code layout change.
[wolnelektury.git] / src / suggest / models.py
1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 #
5 from django.db import models
6 from django.contrib.auth.models import User
7 from django.utils.translation import ugettext_lazy as _
8
9 class Suggestion(models.Model):
10     contact = models.CharField(_('contact'), blank=True, max_length=120)
11     description = models.TextField(_('description'), blank=True)
12     created_at = models.DateTimeField(_('creation date'), auto_now=True)
13     ip = models.GenericIPAddressField(_('IP address'))
14     user = models.ForeignKey(User, blank=True, null=True)
15
16     class Meta:
17         ordering = ('-created_at',)
18         verbose_name = _('suggestion')
19         verbose_name_plural = _('suggestions')
20
21     def __unicode__(self):
22         return unicode(self.created_at)
23
24
25 class PublishingSuggestion(models.Model):
26     contact = models.CharField(_('contact'), blank=True, max_length=120)
27     books = models.TextField(_('books'), null=True, blank=True)
28     audiobooks = models.TextField(_('audiobooks'), null=True, blank=True)
29     created_at = models.DateTimeField(_('creation date'), auto_now_add=True)
30     ip = models.GenericIPAddressField(_('IP address'))
31     user = models.ForeignKey(User, blank=True, null=True)
32
33     class Meta:
34         ordering = ('-created_at',)
35         verbose_name = _('publishing suggestion')
36         verbose_name_plural = _('publishing suggestions')
37
38     def __unicode__(self):
39         return unicode(self.created_at)