diff --git a/peachjam/debugging.py b/peachjam/debugging.py new file mode 100644 index 000000000..ca1874f46 --- /dev/null +++ b/peachjam/debugging.py @@ -0,0 +1,24 @@ +import threading + +import debug_toolbar.utils + + +class ThreadCollector: + def __init__(self): + self.data = threading.local() + self.data.collection = [] + + def collect(self, item): + if hasattr(self.data, "collection"): + self.data.collection.append(item) + + def get_collection(self): + return getattr(self.data, "collection", []) + + def clear_collection(self): + self.data.collection = [] + + +# monkey patch django debug toolbar so that elastic_panel's broken import still works +# see https://github.com/Benoss/django-elasticsearch-debug-toolbar/pull/21 +debug_toolbar.utils.ThreadCollector = ThreadCollector diff --git a/peachjam/settings.py b/peachjam/settings.py index c0b477412..25d9cee22 100644 --- a/peachjam/settings.py +++ b/peachjam/settings.py @@ -182,6 +182,7 @@ INSTALLED_APPS.append("elastic_panel") MIDDLEWARE.append("debug_toolbar.middleware.DebugToolbarMiddleware") INTERNAL_IPS = ["127.0.0.1"] + import peachjam.debugging # noqa # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases diff --git a/peachjam/templates/peachjam/layouts/base.html b/peachjam/templates/peachjam/layouts/base.html index c5c68a417..63ed8113f 100644 --- a/peachjam/templates/peachjam/layouts/base.html +++ b/peachjam/templates/peachjam/layouts/base.html @@ -13,36 +13,36 @@ type="application/atom+xml" title="Atom RSS Feed" href="{% url 'atom_feed' %}"/> - {% ifequal request.path '/judgments/' %} + {% if request.path == '/judgments/' %} - {% endifequal %} - {% ifequal request.path '/doc/' %} + {% endif %} + {% if request.path == '/doc/' %} - {% endifequal %} - {% ifequal request.path '/legal_instruments/' %} + {% endif %} + {% if request.path == '/legal_instruments/' %} - {% endifequal %} - {% ifequal request.path '/legislation/' %} + {% endif %} + {% if request.path == '/legislation/' %} - {% endifequal %} - {% ifequal request.path '/articles/' %} + {% endif %} + {% if request.path == '/articles/' %} - {% endifequal %} + {% endif %} {% block favicon %} =6.0.0", "cssutils >= 2", "dj-database-url>=0.5.0", - "Django~=3.2.13", - "django-advanced-password-validation==1.1.1", + "Django~=4.2", + "django-advanced-password-validation>=1.1", "django-allauth[socialaccount]>=0.62.0", "django-autocomplete-light>=3.9.7", - "django-background-tasks>=1.2.5", + "django-background-tasks-updated>=1.2.8", "django-ckeditor>=6.4.2", "django-compressor>=3.1", "django-cors-headers>=4.3.1", "django-countries-plus>=1.3.2", - "django-debug-toolbar>=3.2.4,<4.2.0", + "django-debug-toolbar>=4.4", "django-elasticsearch-debug-toolbar>=3.0.2", "django-elasticsearch-dsl>=7.2.2,<8.0.0", "django-elasticsearch-dsl-drf>=0.22.4",