From ae9366fc3f24d869fa9cce7c0077d06e6db95571 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 13 Apr 2018 13:23:35 +0200 Subject: New type of operation: court-ordered seizure with associated fields (refs #4048) * models * migrations * wizard panel * forms * sheet --- ishtar_common/forms.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ishtar_common/forms.py') 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: -- cgit v1.2.3