# Remove view
* refactors remove view methods into classes * introduced AbstractRemoveView * disables final-delete actions from admin views * extends error warnings on RemoveEcoAccountModalForm * removes LoginRequiredMixin from AbstractPublicReportView to make it accessible for the public * updates translations
This commit is contained in:
@@ -15,6 +15,7 @@ from compensation.models import EcoAccount
|
||||
from intervention.models import Handler, Responsibility, Legal
|
||||
from konova.forms import SimpleGeomForm
|
||||
from konova.forms.modals import RemoveModalForm
|
||||
from konova.settings import ETS_GROUP
|
||||
from konova.utils import validators
|
||||
from user.models import User, UserActionLogEntry
|
||||
|
||||
@@ -246,4 +247,13 @@ class RemoveEcoAccountModalForm(RemoveModalForm):
|
||||
"confirm",
|
||||
_("The account can not be removed, since there are still deductions.")
|
||||
)
|
||||
|
||||
# If there are deductions but the performing user is not part of an ETS group, we assume this poor
|
||||
# fella does not know what he/she does -> give a hint that they should contact someone in charge...
|
||||
user_is_ets_user = self.user.in_group(ETS_GROUP)
|
||||
if not user_is_ets_user:
|
||||
self.add_error(
|
||||
"confirm",
|
||||
_("Please contact the responsible conservation office to find a solution!")
|
||||
)
|
||||
return super_valid and not has_deductions
|
||||
|
||||
Reference in New Issue
Block a user