Creating a Custom Panel for the Django Debug Toolbar

Sometimes you work on stuff you don’t really control, eg. when interacting with some mysterious SOAP server accross the Internets, and you’d appreciate a little help from the Django ecosystem to ease debugging.

That’s — you guessed it — my case currently, and I really appreciated being able to create my own custom panel for adding specific debugging capabilities to the awesome Django Debug Toolbar.

Here’s how I did, learning mainly from the code of the panels shipping with the DJT. I’m supposing you have installed and configured the DJT in your project already.

First of all, create a module within one of your app (or wherever you want as it’s in your python path) and create a DebugPanel derivated class, like this:

from debug_toolbar.panels import DebugPanel
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _

class MyUsefulDebugPanel(DebugPanel):
    name = 'MyUseful'
    has_content = True

    def nav_title(self):
        return _('Useful Infos')

    def title(self):
        return _('My Useful Debug Panel')

    def url(self):
        return ''

    def content(self):
        context = self.context.copy()
            'infos': [
                {'plop': 'plip'},
                {'plop': 'plup'},
        return render_to_string('panels/my_useful_panel.html', context)

The debug panel class methods and code should be self-explanatory enough. Just note you have to create a template, here panels/my_useful_panel.html to be stored in your project templates directory, with this kind of contents:

<p>Hey, these are useful informations, I swear:</p>
{% for info in infos %}
    <li>Plop is {{ info.plop}}</li>
{% endfor %}

Now you have to register the new panel by adding its path to the DEBUG_TOOLBAR_PANELS tuple, in your (create it if it’s not there):


Of course it’s up to you to put really useful informations there, but here’s the result, tadaa:

Thanks for reading, happy ponying.

Opinion piece ran back in March on Haaretz:

Hitler-Trump Analogies Are Drastic, but We Can’t Miss the Warning Signs Again

Since the Holocaust, American Jews’ collective cry has been: Don’t let history be repeated. That starts with zero tolerance for inflammatory speech. Trump’s campaign is made of little else.

What did we see when thousands of Donald Trump supporters obediently raised their right arms high in the air to pledge support for him? It’s unlikely that many American Jewish voters saw that as just another election rally scene. The visual echoes were visceral, immediate and repellant.

More than any theological belief, the one shared value that has characterized the American-Jewish worldview of the 20th and 21st centuries is ‘Never Again.’
The historical imperative to never repeat the Holocaust has served as a core component of the education of American Jewish youth for three generations. 

We visit Holocaust museums and memorials and some - actual death camps. It seems as if half of our Jewish education is devoted to text and traditions; the other half to bearing witness to our recent collective trauma, vowing communally that never again will we fall victim to persecution, never again will we allow such evil to take root.

read more:

#Repost with @repostapp.
It’s relaxing time. #studio #studiomonitors #genelec #dj #djt #djtips #speaker #speakers #mixer #sound #music #recordingstudio #goodness #goodies #relax #relaxing #everyday #enjoy #TheSonicReference #madeinfinland

Made with Instagram
Corner Man

We know this photo is significant — used in the promo video and the pic of Callen with Arkady, shows him studying the image.

Been letting thoughts on the photo marinate for a few days and this is some theories floating around in my mind.

Same Tea house in the picture. So was this a meeting place for those who bore the Lenin coin? How long has Arkady owned the tea house?

Corner man, who conveniently has his back turned, want to bet he is suppose to be Callen’s father. Notice he has dark hair which is opposite of the man in the family film. So has he been hiding in plain sight?

The promised reveal. How “big” can it be? I can’t see the audience getting to meet the mysterious Reznikov yet. SB’s own statements see this event as something for further season’s. So what do we learn about Callen’s father this time? Not the promised hero? Released early from prison for good behavior or never was in prison. Another name, perhaps the Chernoff, K.(though I still see that as a Hetty alias)

Another reason I am stalling on Callen’s Father being revealed now, I don’t want DJT to play him. I think DJT is great actor, with a wide range and depth in his career but not right for the unknown father of Callen. He can be an uncle, which might be interesting. Callen having actual blood relations, who is not at all the man he portrays his self as and possibly involved with keeping his brother away from his son. Yes, great. Just not Callen’s father.

I want DJT to be for Hetty, one of the acquaintances mentioned from the past. Their interaction can lead to good sparring matches. Also tie him into the mole story that is dangling out there.(With that somehow linking the IA investigation on Deeks.)

Just not Reznikov, or whatever his name may be.