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 | 402b89998b9818d769fd594df1f5ae6f2c263cae (patch) | |
tree | a9630078617057d6fdc11aae7757a523778963c2 /ishtar_common | |
parent | 15fd5e2c3cfee083f1c562a7e3ccdf657d16acee (diff) | |
download | Ishtar-402b89998b9818d769fd594df1f5ae6f2c263cae.tar.bz2 Ishtar-402b89998b9818d769fd594df1f5ae6f2c263cae.zip |
Fix wizard validations
Diffstat (limited to 'ishtar_common')
-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 |