Skip to content

Commit

Permalink
Merge pull request #157 from stuartmaxwell:dont-record-stats-for-logg…
Browse files Browse the repository at this point in the history
…ed-in-users

Dont-record-stats-for-logged-in-users
  • Loading branch information
stuartmaxwell authored Nov 27, 2024
2 parents 3081a02 + f0cf178 commit e56ea99
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions config/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Context processors for the project."""


def debug_processor(_) -> dict: # noqa: ANN001
"""Add the DEBUG setting to the context."""
from django.conf import settings

return {"DEBUG": settings.DEBUG}
3 changes: 2 additions & 1 deletion config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
env = environ.Env(
# set casting, default value
SECRET_KEY=(str, "this_is_just_a_temporary_secret_key"),
DEBUG=(bool, True),
DEBUG=(bool, False),
ALLOWED_HOSTS=(list, ["127.0.0.1"]),
SENTRY_DSN=(str, ""),
SENTRY_ENVIRONMENT=(str, "development"),
Expand Down Expand Up @@ -125,6 +125,7 @@
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"config.context_processors.debug_processor",
],
},
},
Expand Down
2 changes: 1 addition & 1 deletion templates/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link href="{% static "css/styles.css" %}" rel="stylesheet">
{% endblock css %}

{% if not debug %}
{% if not DEBUG and not user.is_authenticated %}
<script async src="https://u.amanzi.nz/script.js" data-website-id="d5f479d8-65fb-4f80-9823-5fe5ca2e17aa"></script>
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</header>
{% endblock header %}

{% block main_classes %}{% endblock %}"
{% block main_classes %}container{% endblock %}

{% block content %}{% endblock %}

Expand Down

0 comments on commit e56ea99

Please sign in to comment.