Kaydet (Commit) eaa716a4 authored tarafından Tim Graham's avatar Tim Graham

Fixed #19639 - Updated contributing to reflect model choices best practices.

Thanks charettes.
üst e2252bf9
......@@ -136,13 +136,16 @@ Model style
* ``def get_absolute_url()``
* Any custom methods
* If ``choices`` is defined for a given model field, define the choices as
a tuple of tuples, with an all-uppercase name, either near the top of
the model module or just above the model class. Example::
* If ``choices`` is defined for a given model field, define each choice as
a tuple of tuples, with an all-uppercase name as a class attribute on the
model. Example::
class MyModel(models.Model):
DIRECTION_UP = 'U'
DIRECTION_DOWN = 'D'
DIRECTION_CHOICES = (
('U', 'Up'),
('D', 'Down'),
(DIRECTION_UP, 'Up'),
(DIRECTION_DOWN, 'Down'),
)
Use of ``django.conf.settings``
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment