django-debug-toolbar-checkbox 0.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. django_debug_toolbar_checkbox-0.0.0/.gitignore +4 -0
  2. django_debug_toolbar_checkbox-0.0.0/PKG-INFO +12 -0
  3. django_debug_toolbar_checkbox-0.0.0/README.md +1 -0
  4. django_debug_toolbar_checkbox-0.0.0/debug_toolbar_checkbox/__init__.py +0 -0
  5. django_debug_toolbar_checkbox-0.0.0/debug_toolbar_checkbox/apps.py +5 -0
  6. django_debug_toolbar_checkbox-0.0.0/debug_toolbar_checkbox/static/js/django-debug-toolbar-checkbox.js +15 -0
  7. django_debug_toolbar_checkbox-0.0.0/debug_toolbar_checkbox/templates/admin/base_site.html +7 -0
  8. django_debug_toolbar_checkbox-0.0.0/debug_toolbar_checkbox/templates/admin/index.html +14 -0
  9. django_debug_toolbar_checkbox-0.0.0/debug_toolbar_checkbox/templates/debug_toolbar/admin/debug_toolbar.html +9 -0
  10. django_debug_toolbar_checkbox-0.0.0/debug_toolbar_checkbox/tests.py +3 -0
  11. django_debug_toolbar_checkbox-0.0.0/debug_toolbar_checkbox/urls.py +7 -0
  12. django_debug_toolbar_checkbox-0.0.0/debug_toolbar_checkbox/views.py +28 -0
  13. django_debug_toolbar_checkbox-0.0.0/django_debug_toolbar_checkbox.egg-info/PKG-INFO +12 -0
  14. django_debug_toolbar_checkbox-0.0.0/django_debug_toolbar_checkbox.egg-info/SOURCES.txt +17 -0
  15. django_debug_toolbar_checkbox-0.0.0/django_debug_toolbar_checkbox.egg-info/dependency_links.txt +1 -0
  16. django_debug_toolbar_checkbox-0.0.0/django_debug_toolbar_checkbox.egg-info/requires.txt +1 -0
  17. django_debug_toolbar_checkbox-0.0.0/django_debug_toolbar_checkbox.egg-info/top_level.txt +1 -0
  18. django_debug_toolbar_checkbox-0.0.0/pyproject.toml +23 -0
  19. django_debug_toolbar_checkbox-0.0.0/setup.cfg +4 -0
@@ -0,0 +1,4 @@
1
+ *.egg-info/
2
+ build/
3
+ .envrc
4
+ dist/
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-debug-toolbar-checkbox
3
+ Version: 0.0.0
4
+ Summary: An admin page with a checkbox to enable the Django Debug Toolbar.
5
+ Author: Julien Palard
6
+ License: BSD-3-Clause
7
+ Project-URL: Source, https://git.afpy.org/mdk/django-debug-toolbar-checkbox
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: django>=5
11
+
12
+ # Pouette
@@ -0,0 +1 @@
1
+ # Pouette
@@ -0,0 +1,5 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class DebugToolbarCheckboxConfig(AppConfig):
5
+ name = "debug_toolbar_checkbox"
@@ -0,0 +1,15 @@
1
+ window.addEventListener("DOMContentLoaded", function (event) {
2
+ var admin_debug_toolbar = document.getElementById("admin_switch_debug_toolbar");
3
+ if (admin_debug_toolbar) {
4
+ var secret = admin_debug_toolbar.dataset.debugToolbarSecret;
5
+ var is_enabled = document.cookie.indexOf(secret) >= 0;
6
+ admin_debug_toolbar.checked = is_enabled;
7
+ admin_debug_toolbar.addEventListener("click", function(e) {
8
+ if (is_enabled)
9
+ document.cookie = "debug_toolbar_secret=;path=/";
10
+ else
11
+ document.cookie = "debug_toolbar_secret=" + secret + ";path=/";
12
+ location.reload();
13
+ });
14
+ }
15
+ });
@@ -0,0 +1,7 @@
1
+ {% extends "admin/base_site.html" %}
2
+ {% load static %}
3
+
4
+ {% block extrahead %}
5
+ <script src="{% static "js/django-debug-toolbar-checkbox.js" %}"></script>
6
+ {{ block.super }}
7
+ {% endblock %}
@@ -0,0 +1,14 @@
1
+ {% extends "admin/index.html" %}
2
+ {% block content %}
3
+ {% if user.is_superuser %}
4
+ <div class="module">
5
+ <table>
6
+ <tr>
7
+ <th scope="row"><a href="/admin/pages/debug-toolbar">Debug toolbar</a></th>
8
+ <td></td>
9
+ </tr>
10
+ </table>
11
+ </div>
12
+ {% endif %}
13
+ {{ block.super }}
14
+ {% endblock %}
@@ -0,0 +1,9 @@
1
+ {% extends 'admin/base_site.html' %}
2
+ {% load i18n admin_urls static admin_list %}
3
+
4
+ {% block content %}
5
+ <div>
6
+ <input type="checkbox" id="admin_switch_debug_toolbar" data-debug-toolbar-secret="{{ debug_toolbar_secret }}" {% if debug_toolbar_is_enabled %}checked{% endif %}>
7
+ <label class="form-check-label" for="flexSwitchCheckDefault">Enable Debug Toolbar</label>
8
+ </div>
9
+ {% endblock %}
@@ -0,0 +1,3 @@
1
+ from django.test import TestCase
2
+
3
+ # Create your tests here.
@@ -0,0 +1,7 @@
1
+ from django.urls import path
2
+
3
+ from debug_toolbar_checkbox.views import DebugToolbarView
4
+
5
+ urlpatterns = [
6
+ path("debug-toolbar", DebugToolbarView.as_view()),
7
+ ]
@@ -0,0 +1,28 @@
1
+ from django.conf import settings
2
+ from django.contrib import admin
3
+ from django.contrib.auth.mixins import UserPassesTestMixin
4
+ from django.urls import path
5
+ from django.views.generic import TemplateView
6
+
7
+
8
+ class SuperuserAdminView(UserPassesTestMixin, TemplateView):
9
+ """An admin view that can only be seen by superusers."""
10
+ title = "(no title)"
11
+
12
+ def test_func(self):
13
+ return self.request.user.is_superuser
14
+
15
+ def get_context_data(self, **kwargs):
16
+ return {
17
+ **super().get_context_data(**kwargs),
18
+ **admin.site.each_context(self.request),
19
+ "title": self.title,
20
+ }
21
+
22
+
23
+ class DebugToolbarView(SuperuserAdminView):
24
+ template_name = "debug_toolbar/admin/debug_toolbar.html"
25
+ title = "Debug toolbar"
26
+
27
+ def get_context_data(self, **kwargs):
28
+ return super().get_context_data(**kwargs) | {"debug_toolbar_secret": settings.DEBUG_TOOLBAR_SECRET}
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-debug-toolbar-checkbox
3
+ Version: 0.0.0
4
+ Summary: An admin page with a checkbox to enable the Django Debug Toolbar.
5
+ Author: Julien Palard
6
+ License: BSD-3-Clause
7
+ Project-URL: Source, https://git.afpy.org/mdk/django-debug-toolbar-checkbox
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: django>=5
11
+
12
+ # Pouette
@@ -0,0 +1,17 @@
1
+ .gitignore
2
+ README.md
3
+ pyproject.toml
4
+ debug_toolbar_checkbox/__init__.py
5
+ debug_toolbar_checkbox/apps.py
6
+ debug_toolbar_checkbox/tests.py
7
+ debug_toolbar_checkbox/urls.py
8
+ debug_toolbar_checkbox/views.py
9
+ debug_toolbar_checkbox/static/js/django-debug-toolbar-checkbox.js
10
+ debug_toolbar_checkbox/templates/admin/base_site.html
11
+ debug_toolbar_checkbox/templates/admin/index.html
12
+ debug_toolbar_checkbox/templates/debug_toolbar/admin/debug_toolbar.html
13
+ django_debug_toolbar_checkbox.egg-info/PKG-INFO
14
+ django_debug_toolbar_checkbox.egg-info/SOURCES.txt
15
+ django_debug_toolbar_checkbox.egg-info/dependency_links.txt
16
+ django_debug_toolbar_checkbox.egg-info/requires.txt
17
+ django_debug_toolbar_checkbox.egg-info/top_level.txt
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ build-backend = "setuptools.build_meta"
3
+ requires = [
4
+ "setuptools",
5
+ "setuptools-scm",
6
+ ]
7
+
8
+ [project]
9
+ name = "django-debug-toolbar-checkbox"
10
+ description = "An admin page with a checkbox to enable the Django Debug Toolbar."
11
+ readme = "README.md"
12
+ license = { text = "BSD-3-Clause" }
13
+ authors = [
14
+ { name = "Julien Palard" },
15
+ ]
16
+ requires-python = ">=3.10"
17
+ dynamic = [
18
+ "version",
19
+ ]
20
+ dependencies = [
21
+ "django>=5",
22
+ ]
23
+ urls.Source = "https://git.afpy.org/mdk/django-debug-toolbar-checkbox"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+