From 2855f306368972a899cd05b6e0315444b8f33da1 Mon Sep 17 00:00:00 2001 From: Sanj Date: Tue, 24 Apr 2012 11:42:18 +0530 Subject: [PATCH] add PadmaClip generic to Session and Participant --- itf/festival/admin.py | 3 ++- itf/festival/models.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/itf/festival/admin.py b/itf/festival/admin.py index 95b9dbb..7a6419d 100755 --- a/itf/festival/admin.py +++ b/itf/festival/admin.py @@ -43,6 +43,7 @@ class MeetingDayInline(admin.StackedInline): extra = 3 class ParticipantInline(admin.StackedInline): + inlines = [PadmaVideoInline] model = Participant extra = 3 @@ -64,7 +65,7 @@ class ProjectAdmin(admin.ModelAdmin): save_on_top = True class SessionAdmin(admin.ModelAdmin): -# inlines = [PadmaVideoInline] + inlines = [PadmaVideoInline] search_fields = ('title', 'intro',) list_filter = ['day'] list_display = ('__unicode__',) diff --git a/itf/festival/models.py b/itf/festival/models.py index 8fde48f..14fcaa7 100755 --- a/itf/festival/models.py +++ b/itf/festival/models.py @@ -101,6 +101,7 @@ class Participant(ItfModel): short_bio = models.TextField(max_length=255, blank=True, null=True) meeting = models.ForeignKey('Meeting') meetings = models.ManyToManyField('Meeting', related_name='participants') + videos = generic.GenericRelation(PadmaVideo) fts_fields = ['name', 'title', 'short_bio'] def __unicode__(self): @@ -152,7 +153,7 @@ class Session(models.Model): intro = models.TextField(blank=True, null=True) day = models.ForeignKey('MeetingDay') session_no = models.IntegerField(blank=True, null=True) -# videos = generic.GenericRelation(PadmaVideo) + videos = generic.GenericRelation(PadmaClip) def __unicode__(self): return "%s - %s" % (self.day.meeting.title, self.title) # name of meeting - name of session @@ -162,7 +163,8 @@ class Session(models.Model): 'title': self.title, 'intro': self.intro, 'session_no': self.session_no, - 'talks': [t.get_dict() for t in self.talk_set.all()] + 'talks': [t.get_dict() for t in self.talk_set.all()], + 'videos': self.video_set.all() }