summaryrefslogtreecommitdiff
path: root/ishtar_common/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/forms.py')
-rw-r--r--ishtar_common/forms.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py
index 1804e9c7b..f16a3eeb9 100644
--- a/ishtar_common/forms.py
+++ b/ishtar_common/forms.py
@@ -684,7 +684,7 @@ class FieldType:
"""
def __init__(self, key, model, is_multiple=False, extra_args=None,
- empty_first=True):
+ empty_first=True, help_text=True):
self.key = key
self.model = model
self.is_multiple = is_multiple
@@ -692,6 +692,7 @@ class FieldType:
if self.is_multiple:
empty_first = False
self.empty_first = empty_first
+ self.help_text = help_text
def get_choices(self, initial=None):
args = {"empty_first": self.empty_first, "initial": initial}
@@ -700,6 +701,8 @@ class FieldType:
return self.model.get_types(**args)
def get_help(self):
+ if not self.help_text:
+ return
args = {}
if self.extra_args:
args.update(self.extra_args)
@@ -837,6 +840,8 @@ class IshtarForm(BSForm, forms.Form):
if field.key not in self.fields:
return
self.fields[field.key].choices = field.get_choices()
+ if not getattr(field, "help_text", True):
+ return
self.fields[field.key].help_text = field.get_help()
def _clean_model_field(self, key, model):