alphabatecial order for query in person admin addition for country and dept
This commit is contained in:
parent
9dc9daa1e0
commit
808f1d94bb
1 changed files with 6 additions and 1 deletions
|
@ -105,6 +105,7 @@ class PersonAdmin(admin.ModelAdmin):
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
list_display = ['id', 'full_name', 'organization']
|
list_display = ['id', 'full_name', 'organization']
|
||||||
|
|
||||||
#autocomplete_fields = ['organization']
|
#autocomplete_fields = ['organization']
|
||||||
form = autocomplete_fields_form # adjust width of autocomplete_fields organization
|
form = autocomplete_fields_form # adjust width of autocomplete_fields organization
|
||||||
|
|
||||||
|
@ -112,7 +113,11 @@ class PersonAdmin(admin.ModelAdmin):
|
||||||
ordering = ['full_name']
|
ordering = ['full_name']
|
||||||
actions = [download_csv]
|
actions = [download_csv]
|
||||||
|
|
||||||
|
def get_field_queryset(self, db, db_field, request):
|
||||||
|
queryset = super().get_field_queryset(db, db_field, request)
|
||||||
|
if db_field.name == 'organization':
|
||||||
|
queryset = queryset.order_by('country','organisation_english')
|
||||||
|
return queryset
|
||||||
class ResourceKeywordInline(admin.TabularInline):
|
class ResourceKeywordInline(admin.TabularInline):
|
||||||
autocomplete_fields = ['keyword']
|
autocomplete_fields = ['keyword']
|
||||||
model = ResourceKeyword
|
model = ResourceKeyword
|
||||||
|
|
Loading…
Reference in a new issue