This is an old revision of the document!


Django developer guidelines

  • Views must not raise an exception (except raising http states when necessary - i.e. REST API)
  • 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 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 PEP 8)
  • Always use named urls and use reverse valuation both in templates and views e.g.:
    reverse('website:cronOverview', args=(webSiteID,)

    or

    <a href="{% url 'storage:StorageAdmin' %}">Storage</a>
 
python/django_guidelines.1454497346.txt.gz · Last modified: 2016/02/03 12:02 by vondra