-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nicer way to register template_debug views
- Loading branch information
Showing
3 changed files
with
34 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from wagtail.core import hooks | ||
|
||
from v1.views.template_debug import TemplateDebugView | ||
|
||
|
||
try: | ||
from django.urls import re_path | ||
except ImportError: # pragma: nocover | ||
from django.conf.urls import url as re_path | ||
|
||
|
||
def register_template_debug(app_name, url_path, template_name, test_cases): | ||
@hooks.register('register_admin_urls') | ||
def register_template_debug_url(): | ||
return [ | ||
re_path( | ||
rf'^template_debug/{app_name}/{url_path}/', | ||
TemplateDebugView.as_view( | ||
debug_template_name=template_name, | ||
debug_test_cases=test_cases | ||
), | ||
name=f'template_debug_{app_name}_{url_path}' | ||
), | ||
] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters