Add scrobble inlines to admin classes
This commit is contained in:
@ -2,6 +2,8 @@ from django.contrib import admin
|
|||||||
|
|
||||||
from music.models import Artist, Album, Track
|
from music.models import Artist, Album, Track
|
||||||
|
|
||||||
|
from scrobbles.admin import ScrobbleInline
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Album)
|
@admin.register(Album)
|
||||||
class AlbumAdmin(admin.ModelAdmin):
|
class AlbumAdmin(admin.ModelAdmin):
|
||||||
@ -33,3 +35,6 @@ class TrackAdmin(admin.ModelAdmin):
|
|||||||
)
|
)
|
||||||
list_filter = ("album", "artist")
|
list_filter = ("album", "artist")
|
||||||
ordering = ("-created",)
|
ordering = ("-created",)
|
||||||
|
inlines = [
|
||||||
|
ScrobbleInline,
|
||||||
|
]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from podcasts.models import Episode, Podcast, Producer
|
from podcasts.models import Episode, Podcast, Producer
|
||||||
|
from scrobbles.admin import ScrobbleInline
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Producer)
|
@admin.register(Producer)
|
||||||
@ -31,3 +31,6 @@ class EpisodeAdmin(admin.ModelAdmin):
|
|||||||
)
|
)
|
||||||
list_filter = ("podcast",)
|
list_filter = ("podcast",)
|
||||||
ordering = ("-created",)
|
ordering = ("-created",)
|
||||||
|
inlines = [
|
||||||
|
ScrobbleInline,
|
||||||
|
]
|
||||||
|
|||||||
@ -3,6 +3,13 @@ from django.contrib import admin
|
|||||||
from scrobbles.models import Scrobble
|
from scrobbles.models import Scrobble
|
||||||
|
|
||||||
|
|
||||||
|
class ScrobbleInline(admin.TabularInline):
|
||||||
|
model = Scrobble
|
||||||
|
extra = 0
|
||||||
|
raw_id_fields = ('video', 'podcast_episode', 'track')
|
||||||
|
exclude = ('source_id', 'scrobble_log')
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Scrobble)
|
@admin.register(Scrobble)
|
||||||
class ScrobbleAdmin(admin.ModelAdmin):
|
class ScrobbleAdmin(admin.ModelAdmin):
|
||||||
date_hierarchy = "timestamp"
|
date_hierarchy = "timestamp"
|
||||||
@ -16,6 +23,7 @@ class ScrobbleAdmin(admin.ModelAdmin):
|
|||||||
"is_paused",
|
"is_paused",
|
||||||
"played_to_completion",
|
"played_to_completion",
|
||||||
)
|
)
|
||||||
|
raw_id_fields = ('video', 'podcast_episode', 'track')
|
||||||
list_filter = ("is_paused", "in_progress", "source", "track__artist")
|
list_filter = ("is_paused", "in_progress", "source", "track__artist")
|
||||||
ordering = ("-timestamp",)
|
ordering = ("-timestamp",)
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,20 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from scrobbles.models import Scrobble
|
||||||
from videos.models import Series, Video
|
from videos.models import Series, Video
|
||||||
|
from scrobbles.admin import ScrobbleInline
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Series)
|
||||||
class SeriesAdmin(admin.ModelAdmin):
|
class SeriesAdmin(admin.ModelAdmin):
|
||||||
date_hierarchy = "created"
|
date_hierarchy = "created"
|
||||||
list_display = ("name", "tagline")
|
list_display = ("name", "tagline")
|
||||||
ordering = ("-created",)
|
ordering = ("-created",)
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Video)
|
||||||
class VideoAdmin(admin.ModelAdmin):
|
class VideoAdmin(admin.ModelAdmin):
|
||||||
date_hierarchy = "created"
|
date_hierarchy = "created"
|
||||||
|
raw_id_fields = ('tv_series',)
|
||||||
list_display = (
|
list_display = (
|
||||||
"title",
|
"title",
|
||||||
"video_type",
|
"video_type",
|
||||||
@ -22,7 +26,6 @@ class VideoAdmin(admin.ModelAdmin):
|
|||||||
)
|
)
|
||||||
list_filter = ("year", "tv_series", "video_type")
|
list_filter = ("year", "tv_series", "video_type")
|
||||||
ordering = ("-created",)
|
ordering = ("-created",)
|
||||||
|
inlines = [
|
||||||
|
ScrobbleInline,
|
||||||
admin.site.register(Series, SeriesAdmin)
|
]
|
||||||
admin.site.register(Video, VideoAdmin)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user