Add bool icon for public field in admin

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40113
This commit is contained in:
Matias Aguirre 2008-07-25 16:59:00 +00:00
parent baee62cf44
commit 9f8ce8f116
1 changed files with 6 additions and 2 deletions

View File

@ -32,8 +32,12 @@ class DownloadLink(models.Model):
# ugly, but django-admin isn't very versatile right now
def public_link(self):
return _("%s (<a href='%s/toggle/'>toggle</a>)") % \
(self.public and _("Yes") or _("No"), self.id )
img_url = "/media/img/admin/icon-%s.gif" % \
(self.public and "yes" or "no")
html = _('<img alt="%s" src="' + img_url + '"/> ' \
'(<a href="%s/toggle/">Toggle</a>)')
return html % (_(str(self.public)), self.id)
public_link.short_description = u"public"
public_link.allow_tags = True