Loading docs/internals/contributing/writing-code/coding-style.txt +11 −8 Original line number Diff line number Diff line Loading @@ -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`` Loading Loading
docs/internals/contributing/writing-code/coding-style.txt +11 −8 Original line number Diff line number Diff line Loading @@ -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`` Loading