mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 18:52:23 +01:00
Merge branch 'marietje-zuid' into 'dsprenkels/songs-reportnote-filter'
# Conflicts: # marietje/songs/admin.py
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
from django.contrib import admin
|
||||
from django.db.models import Count
|
||||
from django.urls import reverse
|
||||
from django.utils.html import format_html
|
||||
|
||||
from .models import ReportNote, Song
|
||||
|
||||
@ -53,6 +55,14 @@ class SongAdmin(admin.ModelAdmin):
|
||||
|
||||
@admin.register(ReportNote)
|
||||
class ReportNoteAdmin(admin.ModelAdmin):
|
||||
exclude = ('song',)
|
||||
list_display = ('song', 'note', 'user')
|
||||
search_fields = ('song__artist', 'song__title', 'user__name')
|
||||
readonly_fields = ('song',)
|
||||
readonly_fields = ('song_link',)
|
||||
|
||||
@staticmethod
|
||||
def song_link(note):
|
||||
url = reverse("admin:songs_song_change", args=(note.song.id,))
|
||||
return format_html("<a href='{url}'>{song}</a>", url=url, song=note.song)
|
||||
|
||||
song_link.short_description = "Song link"
|
||||
|
||||
Reference in New Issue
Block a user