The Django coding style suggests a standard order of model attributes. Increasing standardisation and predictability of your code style helps other developers read your code.
The Django Coding Style suggests the following order of inner classes, methods and attributes:
This standardisation is very useful when Python should be written to be read.
If our GitHub code review bot spots this issue in your pull request it gives this advice:
1 | + | class CommentModel(models.Model): | |
2 | + | class Meta: | |
3 | + | ordering = ('body',) | |
4 | + | ||
5 | + | body = models.TextField() |
The Django coding style suggests a standard order of model attributes. Increasing standardisation and predictability of your code style helps other developers read your code.
Read more