[locations] Allow editing from detail page
All checks were successful
build & deploy / test (push) Successful in 2m3s
build & deploy / build-and-deploy (push) Successful in 32s

This commit is contained in:
2026-05-02 19:23:33 -04:00
parent 1866b43cbe
commit 666224875b
4 changed files with 46 additions and 3 deletions

View File

@ -1,4 +1,5 @@
from django.db.models import Count
from django.urls import reverse_lazy
from django.views import generic
from locations.models import GeoLocation
from scrobbles.stats import get_scrobble_count_qs
@ -26,3 +27,16 @@ class GeoLocationListView(generic.ListView):
class GeoLocationDetailView(ChartContextMixin, generic.DetailView):
model = GeoLocation
slug_field = "uuid"
class GeoLocationUpdateView(generic.UpdateView):
model = GeoLocation
fields = ["title", "base_run_time_seconds"]
slug_field = "uuid"
template_name = "locations/geolocation_form.html"
success_url = reverse_lazy("locations:geolocation_list")
def get_success_url(self):
return reverse_lazy(
"locations:geolocation_detail", kwargs={"slug": self.object.uuid}
)