diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-05-15 05:31:42 -0700 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2019-05-15 14:31:42 +0200 |
| commit | 97d3321e89c8d4434927bdbc308db1ccffa99d3b (patch) | |
| tree | 47e830992ae4c1007a4962051d0ac64c7c6c4bb2 /docs/ref/forms/widgets.txt | |
| parent | 717362d810955b9514e2ccd989f8a1647c9d7a00 (diff) | |
Changed tuple choices to list in docs.
Diffstat (limited to 'docs/ref/forms/widgets.txt')
| -rw-r--r-- | docs/ref/forms/widgets.txt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index 40f9e52f65..0e701babeb 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -57,12 +57,12 @@ widget on the field. In the following example, the from django import forms - BIRTH_YEAR_CHOICES = ('1980', '1981', '1982') - FAVORITE_COLORS_CHOICES = ( + BIRTH_YEAR_CHOICES = ['1980', '1981', '1982'] + FAVORITE_COLORS_CHOICES = [ ('blue', 'Blue'), ('green', 'Green'), ('black', 'Black'), - ) + ] class SimpleForm(forms.Form): birth_year = forms.DateField(widget=forms.SelectDateWidget(years=BIRTH_YEAR_CHOICES)) @@ -90,14 +90,14 @@ changing :attr:`ChoiceField.choices` will update :attr:`Select.choices`. For example:: >>> from django import forms - >>> CHOICES = (('1', 'First',), ('2', 'Second',)) + >>> CHOICES = [('1', 'First'), ('2', 'Second')] >>> choice_field = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES) >>> choice_field.choices [('1', 'First'), ('2', 'Second')] >>> choice_field.widget.choices [('1', 'First'), ('2', 'Second')] - >>> choice_field.widget.choices = () - >>> choice_field.choices = (('1', 'First and only',),) + >>> choice_field.widget.choices = [] + >>> choice_field.choices = [('1', 'First and only')] >>> choice_field.widget.choices [('1', 'First and only')] |
