Use autocomplete fields for looking up organization

This commit is contained in:
PCoder 2022-01-04 22:57:56 +05:30
parent 8809beedda
commit 98abe82b1d
2 changed files with 7 additions and 4 deletions

View file

@ -58,7 +58,8 @@ class PersonAdmin(admin.ModelAdmin):
),
}),
)
list_display = ['id', 'full_name' ]
list_display = ['id', 'full_name', 'organization']
autocomplete_fields = ['organization']
# list_display_links = ['id']
@ -86,6 +87,7 @@ class ResourceAdmin(admin.ModelAdmin):
search_fields = ['title', 'url', 'citation', 'abstract']
readonly_fields = ['id']
list_display = ['title', 'citation', 'type']
ordering = ['title']
fieldsets = (
(None, {
'fields': (
@ -162,7 +164,8 @@ class RangeAdmin(admin.ModelAdmin):
'fields': ('comments',),
})
)
list_display = ['range_name', 'countries', 'mother_range']
list_display = ['range_name', 'mother_range', 'countries']
ordering = ['range_name']
class PeopleOrganizationInline(admin.TabularInline):
@ -177,7 +180,7 @@ class OrganizationAdmin(admin.ModelAdmin):
]
readonly_fields = ('org_num1',)
search_fields = ['organisation_search', 'org_alpha_search', 'organisation_2', 'organisation_3', 'subject']
list_display = ['organisation_english', 'organisation_2']
list_display = ['organisation_english', 'organisation_2', 'country']
fieldsets = (
(None, {
'fields': (

View file

@ -428,7 +428,7 @@ class Organisation(models.Model):
else:
name = f"{self.organisation_english}"
else:
name = 'NO NAME DEFINED!!!'
name = '---'
return name