Django Model Style Guide
(This post is mostly for my own reference)
James Bennett mentions a Django style guide in his book Practical Django Projects. I couldn’t find reference to it, but the following is the order of things when it comes to models:
- Any constants and/or lists of choices
- The full list of fields
- The Meta class if present
- The Admin class if present
- The __unicode__() method
- The save() method, if its being overridden
- The get_absolute_url() method, if present
- Any additional custom methods
Related posts:
- Django & Djson… er, JSON I must admin this is my first attempt at even...
- Copy Model Object in Django I ran into a situation where I wanted to created...
- Django cron on Webfaction James Bennett addresses one of the most frequently asked questions...
- Django: Filter Model on Date Range I’m sure this is in the documentation *somewhere* but it...
Related posts brought to you by Yet Another Related Posts Plugin.
August 11, 2008
Tags: django Posted in: Programming & Internet




One Response
If you are intrested, the reference the the django docs is here http://docs.djangoproject.com/en/dev/internals/contributing/#model-style
Comments are closed for this entry.