Skip to content

Instantly share code, notes, and snippets.

@acdha
Forked from edsu/snip.py
Created August 31, 2011 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acdha/1183550 to your computer and use it in GitHub Desktop.
Save acdha/1183550 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"
lccns.allow_tags = True
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