diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-21 20:32:42 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-21 20:32:42 +0200 |
commit | 123f44323becafffa0bb4cd5cecbcd85864dc191 (patch) | |
tree | a9630078617057d6fdc11aae7757a523778963c2 /ishtar_common/wizards.py | |
parent | 87f19f1fe6da40eaa43fcd8818045eaef5106ccf (diff) | |
download | Ishtar-123f44323becafffa0bb4cd5cecbcd85864dc191.tar.bz2 Ishtar-123f44323becafffa0bb4cd5cecbcd85864dc191.zip |
Fix wizard validations
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r-- | ishtar_common/wizards.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index e64d259e7..e8052c768 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -715,19 +715,22 @@ class Wizard(NamedUrlWizardView): # check if there is no missing fields # should be managed normally in forms but... - if hasattr(model._meta, 'get_fields'): # django 1.8 - fields = model._meta.get_field() - else: - fields = model._meta.fields + fields = model._meta.get_fields() + - has_problemetic_null = [ - (field.name, field.default == NOT_PROVIDED) - for field in fields + has_problemetic_null = False + for field in fields: if (field.name not in value - or not value[field.name]) - and not field.null and not field.blank - and (not field.default - or field.default == NOT_PROVIDED)] + or not value[field.name]) \ + and (hasattr(field, 'null') + and not field.null) \ + and (hasattr(field, 'blank') + and not field.blank) \ + and (hasattr(field, 'default') + and (not field.default + or field.default == NOT_PROVIDED)): + has_problemetic_null = True + break if has_problemetic_null: continue |