From: Pierre-Alain Dupont Date: Sat, 2 Feb 2013 16:41:00 +0000 (+0000) Subject: news - Adds an optionnal linked event to the model X-Git-Url: http://git.polytechnique.org/?p=xnet;a=commitdiff_plain;h=b6ba790e803d96ed7b2c6b2609b7448e116c33c1 news - Adds an optionnal linked event to the model Signed-off-by: Pierre-Alain Dupont --- diff --git a/xnet/news/admin.py b/xnet/news/admin.py index d7cae64..69224ac 100644 --- a/xnet/news/admin.py +++ b/xnet/news/admin.py @@ -4,7 +4,7 @@ from . import models class NewsAdmin(admin.ModelAdmin): - list_display = ['title', 'group', 'author', 'expiration', 'restricted'] + list_display = ['title', 'group', 'author', 'expiration', 'restricted', 'attached_event'] list_filter = ['group', 'author'] search_fields = ['group__name', 'title', 'content', 'author__first_name', 'author__last_name', 'contacts'] diff --git a/xnet/news/models.py b/xnet/news/models.py index ef81f59..f3b3170 100644 --- a/xnet/news/models.py +++ b/xnet/news/models.py @@ -12,14 +12,14 @@ class News(models.Model): illustration = ImageWithThumbsField(upload_to='news', verbose_name=u"illustration", null=True, blank=True) expiration = models.DateField(verbose_name=u"date de péremption") -# TODO : attached_event = null + attached_event = models.ForeignKey('events.Event', related_name='news', null=True, blank=True) restricted = models.BooleanField(default=True, verbose_name=u"visibilité restreinte") promo_min = models.PositiveSmallIntegerField(verbose_name=u"promotion la plus ancienne", null=True, blank=True) promo_max = models.PositiveSmallIntegerField(verbose_name=u"promotion la plus jeune", null=True, blank=True) - author = models.ForeignKey('accounts.Account', related_name='+') - group = models.ForeignKey('accounts.XGroup', related_name='news') + author = models.ForeignKey('accounts.Account', related_name='+', verbose_name=u"auteur") + group = models.ForeignKey('accounts.XGroup', related_name='news', verbose_name=u"groupe associé") class Meta: verbose_name = u"annonce"