Eco account unit tests

* adds eco account unit tests
* adds validity check to eco account form to check on existing deductions and potential conflict with reduced deductable surface
* improves geojson handling on SimpleGeomForm
* adds/updates translation
This commit is contained in:
2023-08-30 16:20:06 +02:00
parent 4392401f27
commit 5d734638ab
8 changed files with 209 additions and 127 deletions

View File

@@ -150,7 +150,9 @@ def edit_view(request: HttpRequest, id: str):
data_form = EditEcoAccountForm(request.POST or None, instance=acc)
geom_form = SimpleGeomForm(request.POST or None, read_only=False, instance=acc)
if request.method == "POST":
if data_form.is_valid() and geom_form.is_valid():
data_form_valid = data_form.is_valid()
geom_form_valid = geom_form.is_valid()
if data_form_valid and geom_form_valid:
# The data form takes the geom form for processing, as well as the performing user
acc = data_form.save(request.user, geom_form)
messages.success(request, _("Eco-Account {} edited").format(acc.identifier))