mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 19:12:20 +01:00
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.
23 lines
646 B
Python
23 lines
646 B
Python
from django.contrib import admin
|
|
from .models import Queue, Playlist, PlaylistSong, QueueCommand
|
|
|
|
|
|
admin.site.register(Playlist)
|
|
|
|
|
|
@admin.register(Queue)
|
|
class OrderAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'playlist', 'random_playlist')
|
|
|
|
@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',)
|
|
|
|
|
|
admin.site.register(QueueCommand)
|