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 _ | |
1b99f720 | 5 | from xnet.utils.images.fields import ImageWithThumbsField |
2f062660 CM |
6 | |
7 | class News(models.Model): | |
8 | ||
9 | title = models.CharField(max_length=200, verbose_name=u"titre") | |
10 | content = models.TextField(verbose_name=u"contenu") | |
11 | contacts = models.TextField(verbose_name=u"contacts", blank=True) | |
1b99f720 | 12 | illustration = ImageWithThumbsField(upload_to='news', verbose_name=u"illustration", null=True, blank=True) |
2f062660 CM |
13 | expiration = models.DateField(verbose_name=u"date de péremption") |
14 | ||
15 | # TODO : attached_event = null | |
16 | ||
17 | restricted = models.BooleanField(default=True, verbose_name=u"visibilité restreinte") | |
18 | promo_min = models.PositiveSmallIntegerField(verbose_name=u"promotion la plus ancienne", null=True, blank=True) | |
19 | promo_max = models.PositiveSmallIntegerField(verbose_name=u"promotion la plus jeune", null=True, blank=True) | |
20 | ||
21 | author = models.ForeignKey('accounts.Account', related_name='+') | |
22 | group = models.ForeignKey('accounts.XGroup', related_name='news') | |
23 | ||
24 | class Meta: | |
1b99f720 | 25 | verbose_name = u"annonce" |
2f062660 CM |
26 | |
27 | def __unicode__(self): | |
28 | return self.title |