#7 New Form
* adds NewEcoAccountForm * refactors NewCompensationForm into AbstractCompensationForm so main fields can be reused again * fixes template bug in account detail view where the amount of deductions has been displayed instead of the available rest * refactors _generate_new_identifier() into generate_new_identifier() * refactors get_available_rest() into returning both, the total and relative amount * improves saving of SimpleGeometryForm() * adds/updates translations
This commit is contained in:
+7
-8
@@ -285,18 +285,17 @@ class SimpleGeomForm(BaseForm):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
if self.instance.geometry is None:
|
||||
geometry = Geometry.objects.create(
|
||||
geom=self.cleaned_data.get("geom", MultiPolygon(srid=DEFAULT_SRID)),
|
||||
created=action,
|
||||
)
|
||||
self.instance.geometry = geometry
|
||||
self.instance.save()
|
||||
else:
|
||||
try:
|
||||
geometry = self.instance.geometry
|
||||
geometry.geom = self.cleaned_data.get("geom", MultiPolygon(srid=DEFAULT_SRID))
|
||||
geometry.modified = action
|
||||
geometry.save()
|
||||
except (AttributeError) as e:
|
||||
# No geometry or linked instance holding a geometry exist --> create a new one!
|
||||
geometry = Geometry.objects.create(
|
||||
geom=self.cleaned_data.get("geom", MultiPolygon(srid=DEFAULT_SRID)),
|
||||
created=action,
|
||||
)
|
||||
return geometry
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user