[charts] Big revamp of the charts app
This commit is contained in:
50
vrobbler/apps/charts/admin.py
Normal file
50
vrobbler/apps/charts/admin.py
Normal file
@ -0,0 +1,50 @@
|
||||
from charts.models import ChartRecord
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
@admin.register(ChartRecord)
|
||||
class ChartRecordAdmin(admin.ModelAdmin):
|
||||
date_hierarchy = "created"
|
||||
list_display = (
|
||||
"user",
|
||||
"rank",
|
||||
"count",
|
||||
"year",
|
||||
"month",
|
||||
"week",
|
||||
"day",
|
||||
"media_name",
|
||||
"media_type",
|
||||
)
|
||||
list_filter = (
|
||||
"user",
|
||||
"year",
|
||||
"month",
|
||||
"week",
|
||||
"day",
|
||||
"tv_series",
|
||||
"podcast",
|
||||
"board_game",
|
||||
"book",
|
||||
"food",
|
||||
"trail",
|
||||
)
|
||||
ordering = ("-created",)
|
||||
search_fields = (
|
||||
"artist__name",
|
||||
"album__name",
|
||||
"track__title",
|
||||
"tv_series__name",
|
||||
"video__title",
|
||||
"podcast__name",
|
||||
"board_game__name",
|
||||
"book__title",
|
||||
"food__name",
|
||||
"trail__name",
|
||||
)
|
||||
|
||||
def media_name(self, obj):
|
||||
return obj.media_obj
|
||||
|
||||
def media_type(self, obj):
|
||||
return obj.media_type
|
||||
Reference in New Issue
Block a user