Ticket #19639: coding-style.patch

File coding-style.patch, 1.1 KB (added by anonymous, 12 years ago)
  • docs/internals/contributing/writing-code/coding-style.txt

    diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt
    index 0d84cda..2114660 100644
    a b Model style  
    136136  * ``def get_absolute_url()``
    137137  * Any custom methods
    138138
    139 * If ``choices`` is defined for a given model field, define the choices as
    140   a tuple of tuples, with an all-uppercase name, either near the top of
    141   the model module or just above the model class. Example::
    142 
    143       DIRECTION_CHOICES = (
    144           ('U', 'Up'),
    145           ('D', 'Down'),
    146       )
     139* If ``choices`` is defined for a given model field, define each choice as
     140  a tuple of tuples, with an all-uppercase name as a class attribute on the
     141  model. Example::
     142
     143    class MyModel(models.Model):
     144        DIRECTION_UP = 'U'
     145        DIRECTION_DOWN = 'D'
     146        DIRECTION_CHOICES = (
     147            (DIRECTION_UP, 'Up'),
     148            (DIRECTION_DOWN, 'Down'),
     149        )
    147150
    148151Use of ``django.conf.settings``
    149152-------------------------------
Back to Top