#20 Multiple laws
* improves w-100 handling for ModalForms * adds documentation strings
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user