diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-11-21 16:56:36 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-11-21 16:56:36 +0100 |
commit | fe2a6ea1d32042a9f60fd2434cc465ffd9ab0d39 (patch) | |
tree | a7403c8968011f51cbc4a3b9d9a6b1001e4f721b /ishtar_common/forms.py | |
parent | ff60c200ddc406250c335de3b59a56b9327a16ec (diff) | |
download | Ishtar-fe2a6ea1d32042a9f60fd2434cc465ffd9ab0d39.tar.bz2 Ishtar-fe2a6ea1d32042a9f60fd2434cc465ffd9ab0d39.zip |
Custom form: operations forms
Diffstat (limited to 'ishtar_common/forms.py')
-rw-r--r-- | ishtar_common/forms.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 8b97cfbab..eebd912ea 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -336,18 +336,26 @@ def get_data_from_formset(data): class FieldType(object): - def __init__(self, key, model, is_multiple=False): + def __init__(self, key, model, is_multiple=False, extra_args=None): self.key = key self.model = model self.is_multiple = is_multiple + self.extra_args = extra_args def get_choices(self, initial=None): - return self.model.get_types( - empty_first=not self.is_multiple, - initial=initial) + args = { + 'empty_first': not self.is_multiple, + 'initial': initial + } + if self.extra_args: + args.update(self.extra_args) + return self.model.get_types(**args) def get_help(self): - return self.model.get_help() + args = {} + if self.extra_args: + args.update(self.extra_args) + return self.model.get_help(**args) class ManageOldType(object): |