add PadmaClip generic to Session and Participant

This commit is contained in:
Sanj 2012-04-24 11:42:18 +05:30
parent a612e66b62
commit 2855f30636
2 changed files with 6 additions and 3 deletions

View File

@ -43,6 +43,7 @@ class MeetingDayInline(admin.StackedInline):
extra = 3 extra = 3
class ParticipantInline(admin.StackedInline): class ParticipantInline(admin.StackedInline):
inlines = [PadmaVideoInline]
model = Participant model = Participant
extra = 3 extra = 3
@ -64,7 +65,7 @@ class ProjectAdmin(admin.ModelAdmin):
save_on_top = True save_on_top = True
class SessionAdmin(admin.ModelAdmin): class SessionAdmin(admin.ModelAdmin):
# inlines = [PadmaVideoInline] inlines = [PadmaVideoInline]
search_fields = ('title', 'intro',) search_fields = ('title', 'intro',)
list_filter = ['day'] list_filter = ['day']
list_display = ('__unicode__',) list_display = ('__unicode__',)

View File

@ -101,6 +101,7 @@ class Participant(ItfModel):
short_bio = models.TextField(max_length=255, blank=True, null=True) short_bio = models.TextField(max_length=255, blank=True, null=True)
meeting = models.ForeignKey('Meeting') meeting = models.ForeignKey('Meeting')
meetings = models.ManyToManyField('Meeting', related_name='participants') meetings = models.ManyToManyField('Meeting', related_name='participants')
videos = generic.GenericRelation(PadmaVideo)
fts_fields = ['name', 'title', 'short_bio'] fts_fields = ['name', 'title', 'short_bio']
def __unicode__(self): def __unicode__(self):
@ -152,7 +153,7 @@ class Session(models.Model):
intro = models.TextField(blank=True, null=True) intro = models.TextField(blank=True, null=True)
day = models.ForeignKey('MeetingDay') day = models.ForeignKey('MeetingDay')
session_no = models.IntegerField(blank=True, null=True) session_no = models.IntegerField(blank=True, null=True)
# videos = generic.GenericRelation(PadmaVideo) videos = generic.GenericRelation(PadmaClip)
def __unicode__(self): def __unicode__(self):
return "%s - %s" % (self.day.meeting.title, self.title) # name of meeting - name of session 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, 'title': self.title,
'intro': self.intro, 'intro': self.intro,
'session_no': self.session_no, '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()
} }