This commit adds a lot of files, but most of them have no impact on any other code. The thrust here is to start creating chart pages showing which tracks and artists were most played for various time periods. Lots still not working, but we're getting there.
34 lines
708 B
Python
34 lines
708 B
Python
from django.views import generic
|
|
from music.models import Track, Artist, Album
|
|
from scrobbles.stats import get_scrobble_count_qs
|
|
|
|
|
|
class TrackListView(generic.ListView):
|
|
model = Track
|
|
|
|
def get_queryset(self):
|
|
return get_scrobble_count_qs(user=self.request.user).order_by(
|
|
"-scrobble_count"
|
|
)
|
|
|
|
|
|
class TrackDetailView(generic.DetailView):
|
|
model = Track
|
|
slug_field = 'uuid'
|
|
|
|
|
|
class ArtistListView(generic.ListView):
|
|
model = Artist
|
|
|
|
def get_queryset(self):
|
|
return super().get_queryset().order_by("name")
|
|
|
|
|
|
class ArtistDetailView(generic.DetailView):
|
|
model = Artist
|
|
slug_field = 'uuid'
|
|
|
|
|
|
class AlbumListView(generic.ListView):
|
|
model = Album
|