diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-04-13 13:23:35 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-04-13 13:23:35 +0200 |
commit | ae9366fc3f24d869fa9cce7c0077d06e6db95571 (patch) | |
tree | 71d968e3d0b0571b4c1d1bef036774f30e98dbcf /ishtar_common/forms.py | |
parent | b790e4875b47e2951a65eedd36dc661079667541 (diff) | |
download | Ishtar-ae9366fc3f24d869fa9cce7c0077d06e6db95571.tar.bz2 Ishtar-ae9366fc3f24d869fa9cce7c0077d06e6db95571.zip |
New type of operation: court-ordered seizure with associated fields (refs #4048)
* models
* migrations
* wizard panel
* forms
* sheet
Diffstat (limited to 'ishtar_common/forms.py')
-rw-r--r-- | ishtar_common/forms.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index c4d6f2026..70e144980 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -279,10 +279,17 @@ class FormHeader(object): class IshtarForm(forms.Form): TYPES = [] # FieldType list + PROFILE_FILTER = {} # profile key associated to field list HEADERS = {} # field key associated to FormHeader instance def __init__(self, *args, **kwargs): super(IshtarForm, self).__init__(*args, **kwargs) + if self.PROFILE_FILTER: + profile = models.get_current_profile() + for profile_key in self.PROFILE_FILTER: + if not getattr(profile, profile_key): + for field_key in self.PROFILE_FILTER[profile_key]: + self.fields.pop(field_key) for field in self.TYPES: self._init_type(field) for k in self.fields: |