Created
August 31, 2011 13:32
-
-
Save edsu/1183542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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