PersonAdmin: Show organization_url

This commit is contained in:
PCoder 2022-01-17 23:13:33 +05:30
parent 1b9bd6df48
commit 3a29b96513

View file

@ -22,7 +22,7 @@ class PersonAdmin(admin.ModelAdmin):
PeopleResourceInline,
PeopleRangeInline
]
readonly_fields = ['id']
readonly_fields = ['id', 'organization_url']
search_fields = ['title', 'first_name', 'last_name', 'organisation', 'position', 'country__short_name', 'contact_email']
fieldsets = (
(None, {
@ -31,7 +31,7 @@ class PersonAdmin(admin.ModelAdmin):
('mr_mrs', 'title','full_name', 'position'),
('first_name', 'last_name', 'search_name', 'status'),
('contact_email', 'email_2', 'skype', 'professional_phone'),
'organization',
('organization', 'organization_url'),
'personal_url',
'biography',
'field_of_expertise',
@ -69,6 +69,11 @@ class PersonAdmin(admin.ModelAdmin):
ordering = ['full_name']
# list_display_links = ['id']
def organization_url(self, instance):
return format_html('<a href="{0}" target="_blank">{1}</a>',
str(instance.organization.url).strip("#") if instance.organization.url else "",
str(instance.organization.url).strip("#") if instance.organization.url else "")
class ResourceKeywordInline(admin.TabularInline):
autocomplete_fields = ['keyword']