Skip to content

Commit

Permalink
Move the WiP warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Dec 5, 2024
1 parent 0da5a92 commit 2966db0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
12 changes: 0 additions & 12 deletions backend/donations/views/dashboard/admin_dashboard.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from typing import Dict, List, Union

from django.conf import settings
from django.contrib import messages
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.timezone import now
Expand All @@ -25,16 +23,6 @@ def callback(request, context) -> Dict:
today = now()
years_range_ascending = get_current_year_range()

messages.warning(
request,
render_to_string(
"admin/announcements/work_in_progress.html",
context={
"contact_email": settings.CONTACT_EMAIL_ADDRESS,
},
),
)

header_stats: List[List[Dict[str, Union[str, int]]]] = _get_header_stats(today)

yearly_stats: List[Dict] = _get_yearly_stats(years_range_ascending)
Expand Down
15 changes: 14 additions & 1 deletion backend/donations/views/dashboard/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.contrib import messages
from django.template.loader import render_to_string
from django.conf import settings

from .admin_dashboard import callback as admin_callback
from .ngo_dashboard import callback as ngo_callback

UserModel = get_user_model()


def callback(request, context):
user: UserModel = request.user

messages.warning(
request,
render_to_string(
"admin/announcements/work_in_progress.html",
context={
"contact_email": settings.CONTACT_EMAIL_ADDRESS,
},
),
)

if not user or not user.is_authenticated:
return context

Expand Down
4 changes: 4 additions & 0 deletions backend/templates/v3/admin/base_admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ <h1 id="site-name">
{% block content %}
{% include "unfold/helpers/messages.html" %}
{% endblock %}

{% if display_work_in_progress %}
{% include "admin/announcements/work_in_progress.html" %}
{% endif %}

0 comments on commit 2966db0

Please sign in to comment.