-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unmaintained django debug panel in favour of django debug tool…
…bar.
- Loading branch information
Showing
7 changed files
with
57 additions
and
35 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
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
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,35 @@ | ||
from rest_framework.renderers import BrowsableAPIRenderer | ||
|
||
|
||
class LightBrowsableAPIRenderer(BrowsableAPIRenderer): | ||
""" | ||
Custom browsable API renderer that removes filtering and POST forms | ||
for better performance with Django Debug Toolbar. | ||
""" | ||
|
||
def get_filter_form(self, data, view, request): | ||
""" | ||
Don't render the filter form. | ||
""" | ||
return None | ||
|
||
def get_rendered_html_form(self, data, view, method, request): | ||
""" | ||
Don't render the HTML form. | ||
""" | ||
return None | ||
|
||
def get_context(self, data, accepted_media_type, renderer_context): | ||
""" | ||
Modify context to remove unnecessary components. | ||
""" | ||
context = super().get_context(data, accepted_media_type, renderer_context) | ||
|
||
# Remove form-related context | ||
context["display_edit_forms"] = False | ||
context["raw_data_post_form"] = None | ||
context["raw_data_put_form"] = None | ||
context["raw_data_patch_form"] = None | ||
context["raw_data_put_or_patch_form"] = None | ||
|
||
return context |
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
from .dev import * # noqa | ||
|
||
INTERNAL_IPS = ["127.0.0.1"] | ||
|
||
INSTALLED_APPS += ["debug_toolbar"] # noqa | ||
|
||
MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"] # noqa | ||
|
||
CACHES["default"]["TIMEOUT"] = 0 # noqa | ||
|
||
if "process_cache" in CACHES: # noqa | ||
CACHES["process_cache"]["TIMEOUT"] = 0 # noqa |
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
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