Skip to content

Instantly share code, notes, and snippets.

@edsu
Created August 31, 2011 13:32
Show Gist options
  • Save edsu/1183542 to your computer and use it in GitHub Desktop.
Save edsu/1183542 to your computer and use it in GitHub Desktop.
class EssayAdmin(VersionAdmin, ManyToManyAdmin):
form = EssayForm
# helper to put LCCNs mentioned in an essay into the list display
def lccns(obj):
links = []
for title in obj.subjects.all():
a = '<a href="http://chroniclingamerica.loc.gov/lccn/%s>%s</a>' % (title.lccn, title.lccn)
links.append(a)
return mark_safe(', '.join(links))
lccns.short_description = "LCCNs"
list_display = ('title', 'status', 'created_by', 'creator', lccns)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment