Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
python:django_guidelines [2016/02/03 11:59]
vondra
python:django_guidelines [2016/02/03 12:02]
vondra
Line 1: Line 1:
 ====== Django developer guidelines ====== ====== Django developer guidelines ======
-  * Views must not raise an exception +  * Views must not raise an exception ​(except raising http states when necessary - i.e. REST API) 
-  * User must be notified about operation result via django.contrib.messages+  * User should ​be notified about operation result via django.contrib.messages
   * All errors and exceptions must be handled and logged in the functional module and module interface should return True, False or value   * All errors and exceptions must be handled and logged in the functional module and module interface should return True, False or value
   * All internal methods in functional modules (those not meant to be called outside module) should start with _ those methods are not imported when using from module import * (for further reference see [[http://​www.python.org/​dev/​peps/​pep-0008/​|PEP 8]])   * All internal methods in functional modules (those not meant to be called outside module) should start with _ those methods are not imported when using from module import * (for further reference see [[http://​www.python.org/​dev/​peps/​pep-0008/​|PEP 8]])
-  * Always use named urls and use reverse valuation both in templates and views e.g.:<​code python>​reverse('​website:​cronOverview',​ args=(webSiteID,​)</​code>​ or <code html><​a href="​{% url '​storage:​StorageAdmin'​ %}"></​a></​code>​+  * Always use named urls and use reverse valuation both in templates and views e.g.:<​code python>​reverse('​website:​cronOverview',​ args=(webSiteID,​)</​code>​ or <code html><​a href="​{% url '​storage:​StorageAdmin'​ %}">​Storage</​a></​code>​
  
 
python/django_guidelines.txt · Last modified: 2016/02/03 12:02 by vondra