Better request display in the admin interface.
This commit is contained in:
parent
80b37c96f4
commit
b30003847d
1 changed files with 24 additions and 1 deletions
|
@ -40,7 +40,30 @@ class ProfileAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
@admin.register(SongRequest)
|
@admin.register(SongRequest)
|
||||||
class RequestAdmin(admin.ModelAdmin):
|
class RequestAdmin(admin.ModelAdmin):
|
||||||
model = SongRequest
|
# Detail List display
|
||||||
|
list_display = ('get_user',
|
||||||
|
'song',
|
||||||
|
'created_date',
|
||||||
|
'queued_at',
|
||||||
|
'played_at')
|
||||||
|
search_fields = ['song', 'profile']
|
||||||
|
|
||||||
|
# Edit Form display
|
||||||
|
readonly_fields = (
|
||||||
|
'created_date',
|
||||||
|
'modified_date',
|
||||||
|
'profile',
|
||||||
|
'song',
|
||||||
|
'queued_at',
|
||||||
|
'played_at'
|
||||||
|
)
|
||||||
|
|
||||||
verbose_name = 'request'
|
verbose_name = 'request'
|
||||||
verbose_name_plural = 'requests'
|
verbose_name_plural = 'requests'
|
||||||
extra = 0
|
extra = 0
|
||||||
|
|
||||||
|
def get_user(self, obj):
|
||||||
|
'''Returns the username from the profile.'''
|
||||||
|
return obj.profile.user
|
||||||
|
get_user.admin_order_field = 'profile'
|
||||||
|
get_user.short_description = 'User Name'
|
||||||
|
|
Loading…
Reference in a new issue