Commit | Line | Data |
---|---|---|
2f062660 CM |
1 | # coding: utf-8 |
2 | ||
3 | from django.db import models | |
4 | from django.utils.translation import ugettext_lazy as _ | |
95fa5c13 RB |
5 | |
6 | from xnet.accounts import models as accounts_models | |
7 | from xnet.groups import models as groups_models | |
8 | ||
1b99f720 | 9 | from xnet.utils.images.fields import ImageWithThumbsField |
2f062660 CM |
10 | |
11 | class News(models.Model): | |
12 | ||
13 | title = models.CharField(max_length=200, verbose_name=u"titre") | |
14 | content = models.TextField(verbose_name=u"contenu") | |
15 | contacts = models.TextField(verbose_name=u"contacts", blank=True) | |
1b99f720 | 16 | illustration = ImageWithThumbsField(upload_to='news', verbose_name=u"illustration", null=True, blank=True) |
2f062660 CM |
17 | expiration = models.DateField(verbose_name=u"date de péremption") |
18 | ||
b6ba790e | 19 | attached_event = models.ForeignKey('events.Event', related_name='news', null=True, blank=True) |
2f062660 CM |
20 | |
21 | restricted = models.BooleanField(default=True, verbose_name=u"visibilité restreinte") | |
2f062660 | 22 | |
95fa5c13 RB |
23 | author = models.ForeignKey(accounts_models.Account, related_name='+', verbose_name=u"auteur") |
24 | group = models.ForeignKey(groups_models.XGroup, related_name='news', verbose_name=u"groupe associé") | |
2f062660 CM |
25 | |
26 | class Meta: | |
1b99f720 | 27 | verbose_name = u"annonce" |
2f062660 CM |
28 | |
29 | def __unicode__(self): | |
30 | return self.title |