Fix village update view.
This commit is contained in:
parent
9bfc206b53
commit
5472dbb4b7
|
@ -18,6 +18,7 @@ class VillageListView(CampViewMixin, ListView):
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return super().get_queryset().filter(deleted=False)
|
return super().get_queryset().filter(deleted=False)
|
||||||
|
|
||||||
|
|
||||||
class VillageDetailView(CampViewMixin, DetailView):
|
class VillageDetailView(CampViewMixin, DetailView):
|
||||||
model = Village
|
model = Village
|
||||||
template_name = 'village_detail.html'
|
template_name = 'village_detail.html'
|
||||||
|
@ -68,7 +69,7 @@ class VillageUpdateView(CampViewMixin, EnsureUserOwnsVillageMixin, LoginRequired
|
||||||
village = form.save(commit=False)
|
village = form.save(commit=False)
|
||||||
if not village.name:
|
if not village.name:
|
||||||
village.name = "noname"
|
village.name = "noname"
|
||||||
return HttpResponseRedirect(village.get_absolute_url())
|
return super().form_valid(form)
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
return self.get_object().get_absolute_url()
|
return self.get_object().get_absolute_url()
|
||||||
|
|
Loading…
Reference in a new issue