Files
vrobbler/vrobbler/apps/scrobbles/apps.py
Colin Powell 881450eb8d
All checks were successful
build & deploy / test (push) Successful in 1m43s
build & deploy / deploy (push) Successful in 21s
[charts] Clean up, add tests and signals
2026-03-23 11:58:05 -04:00

22 lines
636 B
Python

from django.apps import AppConfig
from django.contrib import admin
class ScrobblesConfig(AppConfig):
name = "scrobbles"
def ready(self):
import scrobbles.signals # noqa
from scrobbles.models import Scrobble
original_index = admin.site.index
def custom_index(request, extra_context=None):
extra_context = extra_context or {}
extra_context["recent_scrobbles"] = Scrobble.objects.filter(
timestamp__isnull=False
).order_by("-timestamp")[:20]
return original_index(request, extra_context)
admin.site.index = custom_index