From c92af62f0f9cd7fc1b2cb9d9ca5a71b62788dde7 Mon Sep 17 00:00:00 2001 From: Michael Maurizi Date: Mon, 16 May 2022 09:14:21 -0400 Subject: [PATCH 1/2] Use autocomplete ordered by name for admin Contributors dropdown Connects #1643 --- src/django/api/admin.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/django/api/admin.py b/src/django/api/admin.py index 93dd31fea..42cc317a2 100644 --- a/src/django/api/admin.py +++ b/src/django/api/admin.py @@ -94,8 +94,12 @@ class ContributorAdmin(SimpleHistoryAdmin): history_list_display = ('is_verified', 'verification_notes') search_fields = ('name', 'admin__email') + def get_ordering(self, request): + return ['name'] + class FacilityClaimAdmin(SimpleHistoryAdmin): + autocomplete_fields = ('parent_company', ) history_list_display = ('id', 'contact_person', 'created_at', 'status') readonly_fields = ('contributor', 'facility', 'status_change_reason', 'status_change_by', 'status_change_date', 'status') @@ -112,6 +116,7 @@ class FacilityAliasAdmin(SimpleHistoryAdmin): class SourceAdmin(admin.ModelAdmin): + autocomplete_fields = ('contributor', ) readonly_fields = ('source_type', 'facility_list', 'create') list_filter = ('source_type', 'contributor') @@ -137,6 +142,7 @@ def changeform_view(self, request, object_id=None, form_url='', class ApiLimitAdmin(admin.ModelAdmin): + autocomplete_fields = ('contributor', ) history_list_display = ('contributor', 'yearly_limit', 'created_at', 'updated_at', 'period_start_date') From 235d87e5d411e23c0b3024cbff0e4cc89c33aa36 Mon Sep 17 00:00:00 2001 From: Michael Maurizi Date: Mon, 16 May 2022 10:36:01 -0400 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d88b0594..6865d8cb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added ### Changed +- Use autocomplete ordered by name for admin contributors dropdown [#1848](https://github.com/open-apparel-registry/open-apparel-registry/pull/1848) ### Deprecated