mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 09:12:23 +01:00
17 lines
375 B
Python
17 lines
375 B
Python
from django.contrib import admin
|
|
|
|
from .models import Song
|
|
|
|
|
|
@admin.register(Song)
|
|
class SongAdmin(admin.ModelAdmin):
|
|
list_display = ('artist', 'title', 'user_name')
|
|
search_fields = ('artist', 'title', 'user__name')
|
|
|
|
@staticmethod
|
|
def user_name(obj):
|
|
try:
|
|
return obj.user.name
|
|
except AttributeError:
|
|
return '<unknown>'
|