Skip to content

Better support for 3rd party panels needing URLs/views. #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
robhudson opened this issue Nov 9, 2013 · 5 comments · Fixed by #456
Closed

Better support for 3rd party panels needing URLs/views. #448

robhudson opened this issue Nov 9, 2013 · 5 comments · Fixed by #456
Labels

Comments

@robhudson
Copy link
Contributor

This is an idea I had long ago but apparently never wrote down.

The idea was: imagine if the SQL panel were a 3rd party panel. The steps to integrate the panel would require both a debug toolbar setting to activate the panel but also a URL insertion to map a new URL to the view.

My thought was we could adopt something similar to what the admin does where it allows custom admin URLs to be added. I think it's get_urls on the admin class or something.

If panels had a similar mechanism to provide their own URLs and views, that opens up more options for 3rd party panels to be able to do their own calls out to views for AJAX or the like.

@aaugustin
Copy link
Contributor

Yes, that's a good idea, and built-in panels should use this API too.

@aaugustin
Copy link
Contributor

Whoops, this issue is still valid. The commit linked above merely sets the stage.

@aaugustin aaugustin reopened this Nov 12, 2013
@aaugustin
Copy link
Contributor

f48039e was an important step towards this goal.

Now that I have DebugToolbar.get_panel_classes(), I can easily implement DebugToolbar.get_urls() to collect URL patterns provided by each panel.

The syntax for including URLs will have to change, I think I can make it as simple as:

if settings.DEBUG:
    urlpatterns += patterns('',
        url(r'^__debug__/', include(debug_toolbar.urls)),
    )

where urls will be a callable implemented in debug_toolbar.toolbar and imported in debug_toolbar.

@aaugustin
Copy link
Contributor

The solution I just committed looks pretty clean to me.

@robhudson, let me know if you have suggestions.

@robhudson
Copy link
Contributor Author

Beautiful.

ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this issue Oct 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants