From 034509d5230d4b3f891272a9a01f268cdd8a7e51 Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 26 Nov 2021 17:03:44 +0530 Subject: [PATCH] Introduce clickable resource_url --- app/admin.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/app/admin.py b/app/admin.py index 5ff06b2..4fbbbca 100644 --- a/app/admin.py +++ b/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 '%s' % (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 = (