Skip to content

Commit

Permalink
Merge pull request #95 from GeriLife/django-debug-toolbar
Browse files Browse the repository at this point in the history
Add Django debug toolbar
  • Loading branch information
brylie authored Jan 9, 2024
2 parents 4a0ca84 + cc2bc24 commit 9f82369
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 19 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 12 additions & 3 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
default=True,
)

INTERNAL_IPS = [
"127.0.0.1",
]

ALLOWED_HOSTS = env.list(
"DJANGO_ALLOWED_HOSTS",
default=[
Expand All @@ -56,6 +60,7 @@
"django.contrib.staticfiles",
"crispy_forms",
"crispy_bootstrap5",
"debug_toolbar",
"accounts",
"activities",
"caregivers",
Expand All @@ -71,6 +76,12 @@
CRISPY_TEMPLATE_PACK = "bootstrap5"

MIDDLEWARE = [
# The order of MIDDLEWARE is important.
# Include the Debug Toolbar middleware as early as possible in the list.
# However, it must come after any other middleware that encodes
# the response’s content, such as GZipMiddleware.
# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#add-the-middleware
"debug_toolbar.middleware.DebugToolbarMiddleware",
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
Expand All @@ -87,9 +98,7 @@
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
str(BASE_DIR.joinpath("templates")),
],
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand Down
12 changes: 11 additions & 1 deletion core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
from django.views.generic.base import TemplateView

urlpatterns = [
path(
"__debug__/",
include("debug_toolbar.urls"),
),
path("admin/", admin.site.urls),
path(
"i18n/",
Expand Down Expand Up @@ -47,5 +51,11 @@
"work/",
include("work.urls"),
),
path("", TemplateView.as_view(template_name="home.html"), name="home"),
path(
"",
TemplateView.as_view(
template_name="home.html",
),
name="home",
),
]
14 changes: 0 additions & 14 deletions dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,6 @@ def uninstall_all_packages() -> None:
"pip list --outdated",
],
),
Command(
alias="start-db",
help_text="Start the database",
commands_list=[
"docker compose up -d wf_postgres_service",
],
),
Command(
alias="stop-db",
help_text="Stop the database",
commands_list=[
"docker compose stop wf_postgres_service",
],
),
Command(
alias="install",
help_text="Install project dependencies",
Expand Down
13 changes: 12 additions & 1 deletion homes/templates/homes/home_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ <h2 class="mt-3">{% translate "Current Residents" %}</h2>
<table class="table">
<caption>{% translate "Table of residents showing current activity status, total activity count, and daily activity indicators for past seven days." %}</caption>
<tr>
<th class="col">
{% translate "View" %}
</th>
<th class="col-lg-1 col-2">{% translate "Name" %}</th>
<th class="col-md-1">{% translate "Activity Level" %}</th>
<th class="col-md-1 text-center">{% translate "Total Activities" %}</th>
Expand All @@ -36,7 +39,15 @@ <h2 class="mt-3">{% translate "Current Residents" %}</h2>
</tr>
{% for resident in home.current_residents_with_recent_activity_metadata.residents %}
<tr>
<td>{{ resident.resident.full_name }}</td>
<td>
<a class="btn btn-outline-primary btn-sm"
href="{% url 'resident-detail-view' resident.resident.url_uuid %}">
<i class="bi bi-eye"></i>
</a>
</td>
<td>
{{ resident.resident.first_name }}&nbsp;{{ resident.resident.last_initial }}
</td>
<td>
<span class="badge text-bg-{{ resident.resident.activity_level.color_class }}">
{{ resident.resident.activity_level.text }}
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
asgiref==3.7.2
coverage==7.3.3
crispy-bootstrap5==2023.10
Django==5.0
django-crispy-forms==2.1
django-debug-toolbar==4.2.0
django-environ==0.11.2
factory-boy==3.3.0
Faker==21.0.0
Expand Down

0 comments on commit 9f82369

Please sign in to comment.