mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 21:02:24 +01:00
admin: Use autocomplete for user field
Before this patch, we used the default setting, which emits a HTML <select> tag containing a list of *all* the users. We currently have enough users that we do not want to load that complete list every time. So now, use the autocomplete field instead.
This commit is contained in:
@ -12,8 +12,10 @@ class OrderAdmin(admin.ModelAdmin):
|
||||
@admin.register(PlaylistSong)
|
||||
class PlaylistSongAdmin(admin.ModelAdmin):
|
||||
list_display = ('playlist', 'song', 'user', 'state', 'played_at')
|
||||
list_display_links = ('song',)
|
||||
list_filter = ('playlist', 'state', 'user')
|
||||
search_fields = ('song__title', 'song__artist', 'user__name')
|
||||
autocomplete_fields = ('user',)
|
||||
readonly_fields = ('song',)
|
||||
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ class SongAdmin(admin.ModelAdmin):
|
||||
list_display = ('artist', 'title', 'user_name', 'reports')
|
||||
search_fields = ('artist', 'title', 'user__name')
|
||||
inlines = [ReportNoteInline]
|
||||
autocomplete_fields = ('user',)
|
||||
|
||||
@staticmethod
|
||||
def reports(song):
|
||||
@ -35,6 +36,7 @@ class ReportNoteAdmin(admin.ModelAdmin):
|
||||
exclude = ('song',)
|
||||
list_display = ('song', 'note', 'user')
|
||||
search_fields = ('song__artist', 'song__title', 'user__name')
|
||||
autocomplete_fields = ('user',)
|
||||
readonly_fields = ('song_link',)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user