news - Adds an optionnal linked event to the model
authorPierre-Alain Dupont <pad@melix.net>
Sat, 2 Feb 2013 16:41:00 +0000 (16:41 +0000)
committerPierre-Alain Dupont <pad@melix.net>
Sat, 2 Feb 2013 16:41:00 +0000 (16:41 +0000)
Signed-off-by: Pierre-Alain Dupont <pad@melix.net>
xnet/news/admin.py
xnet/news/models.py

index d7cae64..69224ac 100644 (file)
@@ -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']
 
index ef81f59..f3b3170 100644 (file)
@@ -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"