add sponsor field

This commit is contained in:
Sanj 2012-03-09 12:37:44 +05:30
parent 34573e57ab
commit 2194b0bf57
2 changed files with 16 additions and 1 deletions

View File

@ -22,6 +22,10 @@ class MeetingPerformanceImageInline(admin.StackedInline):
model = MeetingPerformanceImage model = MeetingPerformanceImage
extra = 3 extra = 3
class MeetingSponsorInline(admin.StackedInline):
model = MeetingSponsor
extra = 4
class PadmaVideoAdmin(admin.ModelAdmin): class PadmaVideoAdmin(admin.ModelAdmin):
pass pass
@ -44,7 +48,7 @@ class ParticipantInline(admin.StackedInline):
class MeetingAdmin(admin.ModelAdmin): class MeetingAdmin(admin.ModelAdmin):
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}} formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
inlines = [MeetingDayInline, ImageInline, DocumentInline, ParticipantInline] inlines = [MeetingDayInline, ImageInline, DocumentInline, ParticipantInline, MeetingSponsorInline]
prepopulated_fields = {"slug": ("title",)} prepopulated_fields = {"slug": ("title",)}
save_on_top = True save_on_top = True

View File

@ -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['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['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['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']: for s in meeting_data['sessions']:
s.talks = Talk.objects.select_related('image', 'audio', 'document').filter(session__id=s.id) s.talks = Talk.objects.select_related('image', 'audio', 'document').filter(session__id=s.id)
for t in s.talks: for t in s.talks:
@ -82,6 +83,16 @@ class Meeting(ItfModel):
meeting_data['participants'] = self.participants.all() meeting_data['participants'] = self.participants.all()
return meeting_data 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): class Participant(ItfModel):
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
title = models.CharField(max_length=255, blank=True, null=True) title = models.CharField(max_length=255, blank=True, null=True)