Django debug toolbar: Add your site SVN version (1 month, 4 weeks ago)

Monday, 22 September 2008, 20:29 p.m.
Tags: { django programming python }

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',
        [...]
)

Comments

Post yours


Tag Cloud

Archives

Last Comments

Rss Feeds