Introduce clickable resource_url

This commit is contained in:
PCoder 2021-11-26 17:03:44 +05:30
parent 6ff3d84c3b
commit 034509d523

View file

@ -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 = (