3 ms·
The official coding style guide lines already state that it should come immediately after the fields. https://docs.djangoproject.com/en/dev/internals/contribut
by yiiii 4y ago
The official coding style guide lines already state that it should come immediately after the fields.
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#model-style https://docs.djangoproject.com/en/dev/internals/contributing...
- wartijn_ 4y agoNo, it doesn't. Custom manager attributes go between the two: ``` The order of model inner classes and standard methods should be as follows (noting that these are not all required): All database fields Custom manager attributes class Meta def __str__() def save() def get_absolute_url() Any custom methods ``` And that guideline is not really a general guideline of how to make Django projects, but contributing to Django itself. It might make sense to keep that convention for projects build in Django, but that doesn't make this a style guide for those projects.
- selectnull 4y agoOfficial Django docs do NOT say the `class Meta` comes __immediately__ after the fields. The docs give the example (as linked by you) looking like that, but few chapters down you can find this: The order of model inner classes and standard methods should be as follows (noting that these are not all required): All database fields Custom manager attributes class Meta ...