recamshak / django-debug-panel

django-debug-toolbar in WebKit DevTools. Works fine with background Ajax requests and non-HTML responses.
BSD 3-Clause "New" or "Revised" License
404 stars 69 forks source link

Doesn't work for Ajax #5

Closed arctelix closed 10 years ago

arctelix commented 10 years ago

I see there was a fix for this issue already but its still not working. I believe i have everything configured correctly and django-debug-panel 0.7.2 loads and works great for HTTP requests with . I am running Django 1.4.3.

I have fixed the issue by overriding django DebugToolbarMiddleware.show_toolbar() in DebugPanelMiddleware as follows:

from debug_toolbar import middleware
from django.conf import settings

def show_toolbar(request):
    if request.META.get('REMOTE_ADDR', None) not in settings.INTERNAL_IPS:
        return False

    return bool(settings.DEBUG)
middleware.show_toolbar = show_toolbar

The original DebugToolbarMiddleware.show_toolbar() was returning false when request.is_ajax().

recamshak commented 10 years ago

django-debug-panel doesn't work with django-debug-toolbar 1.x.x yet. Thank you for the fix, I will test and merge.

arctelix commented 10 years ago

I have issued a pull request that implements the fix and adds an ajax panel.