Introduce clickable resource_url
This commit is contained in:
parent
6ff3d84c3b
commit
034509d523
1 changed files with 32 additions and 1 deletions
33
app/admin.py
33
app/admin.py
|
@ -46,6 +46,37 @@ class PersonAdmin(admin.ModelAdmin):
|
|||
|
||||
class ResourceAdmin(admin.ModelAdmin):
|
||||
search_fields = ['title', 'url', 'citation', 'abstract']
|
||||
readonly_fields = ['resource_url']
|
||||
# search_fields = ['organisation_search', 'org_alpha_search', 'organisation_2', 'organisation_3', 'subject']
|
||||
# list_display = ['organisation_english', 'country', 'city']
|
||||
# fieldsets = (
|
||||
# (None, {
|
||||
# 'fields': (
|
||||
# ('org_num1', 'acronym', 'category', 'subject'),
|
||||
# 'organisation_english',
|
||||
# ('organisation_2', 'organisation_3'),
|
||||
# 'organisation_original',
|
||||
# )
|
||||
# }),
|
||||
# ('Address', {
|
||||
# 'classes': ('collapse',),
|
||||
# 'fields': (
|
||||
# ('street', 'postcode', 'city'),
|
||||
# ('po_box', 'country', 'lat_long'),
|
||||
# )
|
||||
# }),
|
||||
# ('Other details', {
|
||||
# 'classes': ('collapse',),
|
||||
# 'fields': (('tel', 'email'),
|
||||
# 'url',
|
||||
# 'org_url',
|
||||
# 'tags',
|
||||
# ),
|
||||
# })
|
||||
# )
|
||||
|
||||
def resource_url(self, instance):
|
||||
return '<a href="%s" target="_blank">%s</a>' % (str(instance.url).strip("#"), str(instance.url).strip("#"))
|
||||
|
||||
|
||||
class RangeAdmin(admin.ModelAdmin):
|
||||
|
@ -84,7 +115,7 @@ class RangeAdmin(admin.ModelAdmin):
|
|||
|
||||
|
||||
class OrganizationAdmin(admin.ModelAdmin):
|
||||
readonly_fields = ('org_num1', 'org_url',)
|
||||
readonly_fields = ('org_num1', 'org_url')
|
||||
search_fields = ['organisation_search', 'org_alpha_search', 'organisation_2', 'organisation_3', 'subject']
|
||||
list_display = ['organisation_english', 'country', 'city']
|
||||
fieldsets = (
|
||||
|
|
Loading…
Reference in a new issue