Add location templates
This commit is contained in:
@ -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"
|
||||
|
||||
Reference in New Issue
Block a user