-
-
Save acdha/1183550 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" | |
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