diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/admin.py | 6 | ||||
-rw-r--r-- | program/models.py | 69 |
2 files changed, 57 insertions, 18 deletions
diff --git a/program/admin.py b/program/admin.py index 52ca6b0..bdd3acc 100644 --- a/program/admin.py +++ b/program/admin.py @@ -12,15 +12,15 @@ class BroadcastFormatAdmin(admin.ModelAdmin): class MusicFocusAdmin(admin.ModelAdmin): form = MusicFocusForm - list_display = ('focus', 'abbrev', 'admin_button') + list_display = ('focus', 'abbrev', 'admin_buttons') prepopulated_fields = {'slug': ('focus',)} class ShowInformationAdmin(admin.ModelAdmin): - list_display = ('information', 'abbrev', 'admin_button') + list_display = ('information', 'abbrev', 'admin_buttons') prepopulated_fields = {'slug': ('information',)} class ShowTopicAdmin(admin.ModelAdmin): - list_display = ('topic', 'abbrev', 'admin_button') + list_display = ('topic', 'abbrev', 'admin_buttons') prepopulated_fields = {'slug': ('topic',)} class NoteAdmin(admin.ModelAdmin): diff --git a/program/models.py b/program/models.py index 9e6917c..1f7a75e 100644 --- a/program/models.py +++ b/program/models.py @@ -41,13 +41,26 @@ class ShowInformation(models.Model): verbose_name = _("Show information") verbose_name_plural = _("Show information") - def admin_button(self): + def admin_buttons(self): + buttons = [] if self.button: - return u'<img src="%s" />' % self.button.url + buttons.append(u'<img src="%s" />' % self.button.url) else: - return u'(no button)' - admin_button.short_description = _("Button") - admin_button.allow_tags = True + buttons.append(u'x') + + if self.button_hover: + buttons.append(u'<img src="%s" />' % self.button_hover.url) + else: + buttons.append(u'x') + + if self.big_button: + buttons.append(u'<img src="%s" />' % self.button.url) + else: + buttons.append(u'x') + + return ' '.join(buttons) + admin_buttons.short_description = _("Button") + admin_buttons.allow_tags = True def button_url(self): if self.button: @@ -83,13 +96,26 @@ class ShowTopic(models.Model): verbose_name = _("Show topic") verbose_name_plural = _("Show topics") - def admin_button(self): + def admin_buttons(self): + buttons = [] if self.button: - return u'<img src="%s" />' % self.button.url + buttons.append(u'<img src="%s" />' % self.button.url) else: - return u'(no button)' - admin_button.short_description = _("Button") - admin_button.allow_tags = True + buttons.append(u'x') + + if self.button_hover: + buttons.append(u'<img src="%s" />' % self.button_hover.url) + else: + buttons.append(u'x') + + if self.big_button: + buttons.append(u'<img src="%s" />' % self.button.url) + else: + buttons.append(u'x') + + return ' '.join(buttons) + admin_buttons.short_description = _("Button") + admin_buttons.allow_tags = True def button_url(self): if self.button: @@ -125,13 +151,26 @@ class MusicFocus(models.Model): verbose_name = _("Music focus") verbose_name_plural = _("Music focus") - def admin_button(self): + def admin_buttons(self): + buttons = [] if self.button: - return u'<img src="%s" />' % self.button.url + buttons.append(u'<img src="%s" />' % self.button.url) + else: + buttons.append(u'x') + + if self.button_hover: + buttons.append(u'<img src="%s" />' % self.button_hover.url) else: - return u'(no button)' - admin_button.short_description = _("Button") - admin_button.allow_tags = True + buttons.append(u'x') + + if self.big_button: + buttons.append(u'<img src="%s" />' % self.button.url) + else: + buttons.append(u'x') + + return ' '.join(buttons) + admin_buttons.short_description = _("Button") + admin_buttons.allow_tags = True def button_url(self): if self.button: |