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/topics | |
| parent | 717362d810955b9514e2ccd989f8a1647c9d7a00 (diff) | |
Changed tuple choices to list in docs.
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/db/managers.txt | 4 | ||||
| -rw-r--r-- | docs/topics/db/models.txt | 4 | ||||
| -rw-r--r-- | docs/topics/forms/modelforms.txt | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/docs/topics/db/managers.txt b/docs/topics/db/managers.txt index 6c9e6a4163..a08dddd028 100644 --- a/docs/topics/db/managers.txt +++ b/docs/topics/db/managers.txt @@ -161,7 +161,7 @@ For example:: class Person(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) - role = models.CharField(max_length=1, choices=(('A', _('Author')), ('E', _('Editor')))) + role = models.CharField(max_length=1, choices=[('A', _('Author')), ('E', _('Editor'))]) people = models.Manager() authors = AuthorManager() editors = EditorManager() @@ -261,7 +261,7 @@ custom ``QuerySet`` if you also implement them on the ``Manager``:: class Person(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) - role = models.CharField(max_length=1, choices=(('A', _('Author')), ('E', _('Editor')))) + role = models.CharField(max_length=1, choices=[('A', _('Author')), ('E', _('Editor'))]) people = PersonManager() This example allows you to call both ``authors()`` and ``editors()`` directly from diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt index f895db89fa..6964876a3e 100644 --- a/docs/topics/db/models.txt +++ b/docs/topics/db/models.txt @@ -161,13 +161,13 @@ ones: A choices list looks like this:: - YEAR_IN_SCHOOL_CHOICES = ( + YEAR_IN_SCHOOL_CHOICES = [ ('FR', 'Freshman'), ('SO', 'Sophomore'), ('JR', 'Junior'), ('SR', 'Senior'), ('GR', 'Graduate'), - ) + ] The first element in each tuple is the value that will be stored in the database. The second element is displayed by the field's form widget. diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt index 0bd7833967..fe2e231a36 100644 --- a/docs/topics/forms/modelforms.txt +++ b/docs/topics/forms/modelforms.txt @@ -165,11 +165,11 @@ Consider this set of models:: from django.db import models from django.forms import ModelForm - TITLE_CHOICES = ( + TITLE_CHOICES = [ ('MR', 'Mr.'), ('MRS', 'Mrs.'), ('MS', 'Ms.'), - ) + ] class Author(models.Model): name = models.CharField(max_length=100) |
