Show a clickable url alongside the url field

This commit is contained in:
PCoder 2021-11-26 16:56:36 +05:30
parent 8b2508fbc5
commit 6ff3d84c3b

View file

@ -84,7 +84,7 @@ class RangeAdmin(admin.ModelAdmin):
class OrganizationAdmin(admin.ModelAdmin):
readonly_fields = ('org_num1',)
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 = (
@ -107,11 +107,15 @@ class OrganizationAdmin(admin.ModelAdmin):
'classes': ('collapse',),
'fields': (('tel', 'email'),
'url',
'org_url',
'tags',
),
})
)
def org_url(self, instance):
return '<a href="%s" target="_blank">%s</a>' % (str(instance.url).strip("#"), str(instance.url).strip("#"))
class FieldAdmin(admin.ModelAdmin):
search_fields = ['name']