Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

coding-style.rst 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ============
  2. Coding Style
  3. ============
  4. General
  5. -------
  6. Please follow these conventions while remaining sensible:
  7. * `PEP8 -- Style Guide for Python Code <http://www.python.org/dev/peps/pep-0008/>`_
  8. * `PEP257 -- Docstring Conventions <http://www.python.org/dev/peps/pep-0257/>`_
  9. * `Django Coding Style <http://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/>`_
  10. `Code Like a Pythonista`_ is recommended reading.
  11. .. _Code Like a Pythonista: http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
  12. URLs
  13. ----
  14. * List pages should use plurals; e.g. ``/products/``, ``/notifications/``
  15. * Detail pages should simply be a PK/slug on top of the list page; e.g.
  16. ``/products/the-bible/``, ``/notifications/1/``
  17. * Create pages should have 'create' as the final path segment; e.g.
  18. ``/dashboard/notifications/create/``
  19. * Update pages are sometimes the same as detail pages (i.e., when in the
  20. dashboard). In those cases, just use the detail convention, eg
  21. ``/dashboard/notifications/3/``. If there is a distinction between the detail
  22. page and the update page, use ``/dashboard/notifications/3/update/``.
  23. * Delete pages; e.g., ``/dashboard/notifications/3/delete/``
  24. View class names
  25. ----------------
  26. Classes should be named according to::
  27. '%s%sView' % (class_name, verb)
  28. For example, ``ProductUpdateView``, ``OfferCreateView`` and
  29. ``PromotionDeleteView``. This doesn't fit all situations, but it's a good basis.
  30. Referencing managers
  31. --------------------
  32. Use ``_default_manager`` rather than ``objects``. This allows projects to
  33. override the default manager to provide domain-specific behaviour.