mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1123 from eeintech/fix_form_errors
Fixed disabling of form errors messing-up with global settings validation
This commit is contained in:
commit
d777549a1a
@ -29,11 +29,6 @@ class HelperForm(forms.ModelForm):
|
|||||||
|
|
||||||
self.helper.form_tag = False
|
self.helper.form_tag = False
|
||||||
|
|
||||||
# Check for errors from model validation
|
|
||||||
# If none, disable crispy form errors
|
|
||||||
if not self.errors:
|
|
||||||
self.helper.form_show_errors = False
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Create a default 'layout' for this form.
|
Create a default 'layout' for this form.
|
||||||
Ref: https://django-crispy-forms.readthedocs.io/en/latest/layouts.html
|
Ref: https://django-crispy-forms.readthedocs.io/en/latest/layouts.html
|
||||||
@ -44,6 +39,17 @@ class HelperForm(forms.ModelForm):
|
|||||||
|
|
||||||
self.rebuild_layout()
|
self.rebuild_layout()
|
||||||
|
|
||||||
|
def is_valid(self):
|
||||||
|
|
||||||
|
valid = super(HelperForm, self).is_valid()
|
||||||
|
|
||||||
|
# Check for errors from model validation
|
||||||
|
# If none, disable crispy form errors
|
||||||
|
if not self.errors:
|
||||||
|
self.helper.form_show_errors = False
|
||||||
|
|
||||||
|
return valid
|
||||||
|
|
||||||
def rebuild_layout(self):
|
def rebuild_layout(self):
|
||||||
|
|
||||||
layouts = []
|
layouts = []
|
||||||
|
Loading…
Reference in New Issue
Block a user