unfuck name fuck, well done swedes
This commit is contained in:
parent
3a984acf57
commit
ccfdfa1ba5
|
@ -32,6 +32,8 @@ class VillageCreateView(CampViewMixin, LoginRequiredMixin, EnsureWritableCampMix
|
|||
village = form.save(commit=False)
|
||||
village.contact = self.request.user
|
||||
village.camp = Camp.objects.get(slug=self.request.session['campslug'])
|
||||
if not village.name:
|
||||
village.name = "noname"
|
||||
village.save()
|
||||
return HttpResponseRedirect(village.get_absolute_url())
|
||||
|
||||
|
@ -59,6 +61,12 @@ class VillageUpdateView(CampViewMixin, EnsureUserOwnsVillageMixin, LoginRequired
|
|||
template_name = 'village_form.html'
|
||||
fields = ['name', 'description', 'private']
|
||||
|
||||
def form_valid(self, form):
|
||||
village = form.save(commit=False)
|
||||
if not village.name:
|
||||
village.name = "noname"
|
||||
return HttpResponseRedirect(village.get_absolute_url())
|
||||
|
||||
def get_success_url(self):
|
||||
return self.get_object().get_absolute_url()
|
||||
|
||||
|
|
Loading…
Reference in a new issue