#20 Multiple laws

* improves w-100 handling for ModalForms
* adds documentation strings
This commit is contained in:
mipel
2021-09-20 14:13:59 +02:00
parent b39e96c495
commit 19db05bc1b
2 changed files with 49 additions and 11 deletions

View File

@@ -412,10 +412,13 @@ class RunCheckForm(BaseModalForm):
super().__init__(*args, **kwargs)
self.form_title = _("Run check")
self.form_caption = _("I, {} {}, confirm that all necessary control steps have been performed by myself.").format(self.user.first_name, self.user.last_name)
# Disable automatic w-100 setting for this type of modal form. Looks kinda strange
self.fields["confirm"].widget.attrs["class"] = ""
def is_valid(self):
def is_valid(self) -> bool:
""" Perform a validity check based on quality_check() logic
Returns:
result (bool)
"""
super_result = super().is_valid()
# Perform check
msgs = self.instance.quality_check()
@@ -427,6 +430,11 @@ class RunCheckForm(BaseModalForm):
return super_result and (len(msgs) == 0)
def save(self):
""" Saving logic
Returns:
"""
with transaction.atomic():
user_action = UserActionLogEntry.objects.create(
user=self.user,