diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2013-03-08 22:41:58 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2013-03-08 22:41:58 (GMT) |
commit | 7917b7d8dc101cdbcb1645019db60db6d4de7d01 (patch) | |
tree | 090158cddea0166e9f0989a61715d13271ff2753 /program | |
parent | c31dc0ff0140e054f251d493f862650cc08865db (diff) |
added admin images.
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: |