Prechádzať zdrojové kódy

[scrobbles] Fix admin filtering

Colin Powell 3 týždňov pred
rodič
commit
7d13967708
1 zmenil súbory, kde vykonal 7 pridanie a 1 odobranie
  1. 7 1
      vrobbler/apps/scrobbles/admin.py

+ 7 - 1
vrobbler/apps/scrobbles/admin.py

@@ -102,7 +102,7 @@ class ChartRecordAdmin(admin.ModelAdmin):
 
 @admin.register(Scrobble)
 class ScrobbleAdmin(admin.ModelAdmin):
-    # date_hierarchy = "timestamp"
+    date_hierarchy = "timestamp"
     list_display = (
         "timestamp",
         "media_name",
@@ -112,6 +112,7 @@ class ScrobbleAdmin(admin.ModelAdmin):
         "in_progress",
         "is_paused",
         "played_to_completion",
+        "user",
     )
     raw_id_fields = (
         "video",
@@ -140,6 +141,7 @@ class ScrobbleAdmin(admin.ModelAdmin):
         "long_play_complete",
         "source",
         "timezone",
+        "user",
     )
     ordering = ("-timestamp",)
 
@@ -148,3 +150,7 @@ class ScrobbleAdmin(admin.ModelAdmin):
 
     def playback_percent(self, obj):
         return obj.percent_played
+
+    def get_queryset(self, request):
+        qs = super().get_queryset(request).exclude(timestamp__year=None)
+        return qs