Question: Allow limit of string length (#3214)

This commit is contained in:
Raphael Michel
2023-04-06 09:58:50 +02:00
committed by GitHub
parent b1e8e072d4
commit ddade60625
9 changed files with 47 additions and 2 deletions

View File

@@ -747,12 +747,14 @@ class BaseQuestionsForm(forms.Form):
elif q.type == Question.TYPE_STRING:
field = forms.CharField(
label=label, required=required,
max_length=q.valid_string_length_max,
help_text=help_text,
initial=initial.answer if initial else None,
)
elif q.type == Question.TYPE_TEXT:
field = forms.CharField(
label=label, required=required,
max_length=q.valid_string_length_max,
help_text=help_text,
widget=forms.Textarea,
initial=initial.answer if initial else None,