Merge branch 'master' into 10112/mountain-range-form-change

This commit is contained in:
pcoder116 2022-01-17 18:20:34 +00:00
commit 14cad5b554
2 changed files with 17 additions and 13 deletions

View file

@ -22,16 +22,16 @@ class PersonAdmin(admin.ModelAdmin):
PeopleResourceInline, PeopleResourceInline,
PeopleRangeInline PeopleRangeInline
] ]
readonly_fields = ['id'] readonly_fields = ['id', 'organization_url']
search_fields = ['title', 'first_name', 'last_name', 'organisation', 'position', 'country__short_name', 'contact_email'] search_fields = ['title', 'first_name', 'last_name', 'organisation', 'position', 'country__short_name', 'contact_email']
fieldsets = ( fieldsets = (
(None, { (None, {
'fields': ( 'fields': (
('id'), ('id', 'profile_on_web', 'news_letter'),
('mr_mrs', 'title','full_name', 'position'), ('mr_mrs', 'title','full_name', 'position'),
('first_name', 'last_name', 'search_name', 'status'), ('first_name', 'last_name', 'search_name', 'status'),
('contact_email', 'email_2', 'skype', 'professional_phone'), ('contact_email', 'email_2', 'skype', 'professional_phone'),
'organization', ('organization', 'organization_url'),
'personal_url', 'personal_url',
'biography', 'biography',
'field_of_expertise', 'field_of_expertise',
@ -55,8 +55,8 @@ class PersonAdmin(admin.ModelAdmin):
}), }),
('Others', { ('Others', {
'classes': ('collapse',), 'classes': ('collapse',),
'fields': ('orcid', 'web_of_science', 'twitter', 'instagram', 'updated', 'fields': (
('news_letter', 'profile_on_web'), 'orcid', 'web_of_science', 'twitter', 'instagram', 'updated',
'entry_date', 'entry_date',
'country', 'country',
'gmba_function' 'gmba_function'
@ -69,6 +69,11 @@ class PersonAdmin(admin.ModelAdmin):
ordering = ['full_name'] ordering = ['full_name']
# list_display_links = ['id'] # 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): class ResourceKeywordInline(admin.TabularInline):
autocomplete_fields = ['keyword'] autocomplete_fields = ['keyword']
@ -198,7 +203,7 @@ class OrganizationAdmin(admin.ModelAdmin):
] ]
readonly_fields = ('org_num1',) readonly_fields = ('org_num1',)
search_fields = ['organisation_search', 'org_alpha_search', 'organisation_2', 'organisation_3', 'subject'] search_fields = ['organisation_search', 'org_alpha_search', 'organisation_2', 'organisation_3', 'subject']
list_display = ['organisation_english', 'organisation_2', 'country'] list_display = ['org_num1', 'organisation_english', 'organisation_2', 'country']
fieldsets = ( fieldsets = (
(None, { (None, {
'fields': ( 'fields': (

View file

@ -163,7 +163,8 @@ class Resource(models.Model):
("*****", "*****"), ("*****", "*****"),
) )
TYPE_CHOICES = ( TYPE_CHOICES = (
("", "Atlas"), ("", ""),
("Atlas", "Atlas"),
("Book", "Book"), ("Book", "Book"),
("Book chapter", "Book chapter"), ("Book chapter", "Book chapter"),
("Case study", "Case study"), ("Case study", "Case study"),
@ -575,9 +576,7 @@ class Person(models.Model):
MR_MRS_CHOICES = ( MR_MRS_CHOICES = (
('', ''), ('', ''),
('Ms', 'Ms'), ('Ms', 'Ms'),
('Ms.', 'Ms.'),
('Mr', 'Mr'), ('Mr', 'Mr'),
('Mr.', 'Mr.'),
) )
GMBA_FUNCTION_CHOICES = ( GMBA_FUNCTION_CHOICES = (
('', ''), ('', ''),