[locations] Allow editing from detail page
This commit is contained in:
@ -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}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user