Coding Style¶
General¶
Please follow these conventions while remaining sensible:
Code Like a Pythonista is recommended reading.
URLs¶
- List pages should use plurals; e.g.
/products/
,/notifications/
- Detail pages should simply be a PK/slug on top of the list page; e.g.
/products/the-bible/
,/notifications/1/
- Create pages should have ‘create’ as the final path segment; e.g.
/dashboard/notifications/create/
- URL names use dashes not underscores.
- Update pages are sometimes the same as detail pages (i.e., when in the
dashboard). In those cases, just use the detail convention, eg
/dashboard/notifications/3/
. If there is a distinction between the detail page and the update page, use/dashboard/notifications/3/update/
. - Delete pages; e.g.,
/dashboard/notifications/3/delete/
View class names¶
Classes should be named according to:
'%s%sView' % (class_name, verb)
For example, ProductUpdateView
, OfferCreateView
and
PromotionDeleteView
. This doesn’t fit all situations, but it’s a good basis.
Referencing managers¶
Use _default_manager
rather than objects
. This allows projects to
override the default manager to provide domain-specific behaviour.
HTML¶
Please indent with four spaces.