Thursday, May 26, 2011

Two useful enhancements for Django Debug Toolbar

Sometimes on my work I experience two typical issues: first one is that on unknown projects I don't know what objects was changes, how much objects was changed and what is deleted. To find out what's going on the current page(s) I have to study code of views, internal methods etc. Sometimes it's really pain in the ass, for example if I work on satchmo-based projects.

Another typical issue is hard way to keep valid HTML during long-term development. I don't want to add plugins to my browser which will validate my html. But I still need to develop clean and transparent HTML code. So I made decision to develop additional HTML Validator panel for Django Debug Toolbar.

Past month I've done two panels (screenshots below):

  1. State Debug Panel – debug_toolbar.panels.state.StateDebugPanel
  2. HTML Validator Debug Panel – debug_toolbar.panels.htmlvalidator.HTMLValidationDebugPanel
All of the code was merged with current master of django-debug-panel and available on github

Tuesday, May 3, 2011

Three easy rules about parts of code of apps within django project

Very easy convention about parts of code of apps within django project:

  • Any functions which aren't views shouldn't be placed in
  • Any functions related to work with forms should be in and be method of the form class
  • Any function which used by more than one view/form/function should be saved in