Saturday, June 13, 2009

Django|debug toolbar: Add your own panel

Coulix.org: Django debug toolbar: Add your site SVN version

Django debug toolbar: Add your site


This entry shows a simple way of adding your project current SVN to the django debug toolbar by creating a custom debug panel.

What you need

You need to get django debug toolbar set up on Rob git repository right there

Follow the README.rst on how to install.

The How

from debug_toolbar.panels import DebugPanel from django.utils.version import get_svn_revision import os  class CustomVersionDebugPanel(DebugPanel):     """     Panel that displays your project svn version.     """     name = 'your_site'      def title(self):         return 'your_site_name %s' % ( get_svn_revision(path=os.getcwd()))      def url(self):         return ''      def content(self):         return '' 

Then update the panels settings in settings.py

DEBUG_TOOLBAR_PANELS = (         'base.debugpanels.CustomVersionDebugPanel',         [...] ) 


No comments: