#36212: How about providing type safe access to form field data?
------------------------------+-----------------------------------------
Reporter: Justin Black | Type: Uncategorized
Status: new | Component: Uncategorized
Version: 5.1 | Severity: Normal
Keywords: form, field | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+-----------------------------------------
Right now only cleaned data is acessed in a dict in python.
This means that type hcecking code does not know the type of that dict
unless it is described as a typeddict.
How about providing type safe access to form field data?
```
class FormOptions(forms.Form):
prompt = forms.CharField(widget=forms.Textarea)
n = forms.IntegerField(min_value=1, max_value=10, initial=1)
form_options = FormOptions({'prompt': 'a', 'n': 2})
```
one could access it as:
form_options.prompt.cleaned_data
or
form_options.prompt
This would allow code to access type safe values for a form in python.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36212>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.