Add location templates

This commit is contained in:
2023-11-24 01:33:33 +01:00
parent e04be4fbdd
commit 85a91b340a
7 changed files with 223 additions and 1 deletions

View File

@ -1 +1,22 @@
#!/usr/bin/env python3
from django.db.models import Count
from django.views import generic
from locations.models import GeoLocation
from scrobbles.stats import get_scrobble_count_qs
class GeoLocationListView(generic.ListView):
model = GeoLocation
paginate_by = 200
def get_queryset(self):
return super().get_queryset().order_by("-created")
def get_context_data(self, **kwargs):
context_data = super().get_context_data(**kwargs)
context_data["latest"] = self.get_queryset().first()
return context_data
class GeoLocationDetailView(generic.DetailView):
model = GeoLocation
slug_field = "uuid"