Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Use autocomplete ordered by name for admin Contributors dropdown #1848

Merged
merged 2 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions src/django/api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')

Expand All @@ -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')

Expand Down