From 2194b0bf573e322063b1614cc05d5962ae5e708c Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 9 Mar 2012 12:37:44 +0530 Subject: [PATCH] add sponsor field --- itf/festival/admin.py | 6 +++++- itf/festival/models.py | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/itf/festival/admin.py b/itf/festival/admin.py index 1f93ecb..3a3b09b 100755 --- a/itf/festival/admin.py +++ b/itf/festival/admin.py @@ -22,6 +22,10 @@ class MeetingPerformanceImageInline(admin.StackedInline): model = MeetingPerformanceImage extra = 3 +class MeetingSponsorInline(admin.StackedInline): + model = MeetingSponsor + extra = 4 + class PadmaVideoAdmin(admin.ModelAdmin): pass @@ -44,7 +48,7 @@ class ParticipantInline(admin.StackedInline): class MeetingAdmin(admin.ModelAdmin): formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}} - inlines = [MeetingDayInline, ImageInline, DocumentInline, ParticipantInline] + inlines = [MeetingDayInline, ImageInline, DocumentInline, ParticipantInline, MeetingSponsorInline] prepopulated_fields = {"slug": ("title",)} save_on_top = True diff --git a/itf/festival/models.py b/itf/festival/models.py index 412ed00..bc1aab5 100755 --- a/itf/festival/models.py +++ b/itf/festival/models.py @@ -69,6 +69,7 @@ class Meeting(ItfModel): meeting_data['sessions'] = Session.objects.filter(day__meeting=self).order_by("day").order_by("session_no") meeting_data['documents'] = Document.objects.filter(meeting__id=meeting_id).exclude(talk__isnull=False) meeting_data['performances'] = [p.get_dict() for p in MeetingPerformance.objects.filter(meeting_day__meeting=self)] + meeting_data['sponsors'] = MeetingSponsor.objects.filter(meeting=self) for s in meeting_data['sessions']: s.talks = Talk.objects.select_related('image', 'audio', 'document').filter(session__id=s.id) for t in s.talks: @@ -82,6 +83,16 @@ class Meeting(ItfModel): meeting_data['participants'] = self.participants.all() return meeting_data + +class MeetingSponsor(models.Model): + meeting = models.ForeignKey(Meeting) + name = models.CharField(max_length=256) + url = models.URLField(verify_exists=False, blank=True) + logo = models.ImageField(upload_to='upload/meeting_logos', blank=True) + + def __unicode__(self): + return self.name + class Participant(ItfModel): name = models.CharField(max_length=255) title = models.CharField(max_length=255, blank=True, null=True)