Добавил заглушки, чтобы смотреть статистику по прослушиванию в будущем
This commit is contained in:
@@ -2,7 +2,10 @@ from typing import Any
|
||||
|
||||
from django.contrib import admin
|
||||
from django.http import HttpRequest
|
||||
from django.http import HttpResponse
|
||||
from django.urls import path
|
||||
from django.urls import reverse
|
||||
from django.shortcuts import render
|
||||
from django.utils.html import format_html
|
||||
|
||||
from music.models import Track
|
||||
@@ -114,3 +117,15 @@ class MusicLogAdmin(admin.ModelAdmin):
|
||||
search_fields = ("track__title", "track__album__artist__name", "track__album__name")
|
||||
list_filter = ("played_at",)
|
||||
readonly_fields = ("track", "played_at")
|
||||
|
||||
change_list_template = "admin/musiclog/change_list.html"
|
||||
|
||||
def get_urls(self):
|
||||
urls = super().get_urls()
|
||||
custom_urls = [
|
||||
path("statistics/", self.admin_site.admin_view(self.get_statistic_view), name="musiclog_statistics"),
|
||||
]
|
||||
return custom_urls + urls
|
||||
|
||||
def get_statistic_view(self, request: HttpRequest) -> HttpResponse:
|
||||
return render(request, "admin/musiclog/statistics.html")
|
||||
Reference in New Issue
Block a user