-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/0.3.26' into main
- Loading branch information
Showing
6 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
from typing import Any | ||
|
||
from django.core.checks import messages | ||
from django.core.exceptions import ObjectDoesNotExist | ||
from django.urls import reverse | ||
from django.utils.html import format_html | ||
from django.utils.translation import gettext_lazy as _ | ||
from edc_subject_dashboard.views import SubjectDashboardView | ||
|
||
from meta_reports.models import Endpoints, GlucoseSummary | ||
|
||
|
||
class DashboardView(SubjectDashboardView): | ||
consent_model = "meta_consent.subjectconsentv1" | ||
navbar_selected_item = "consented_subject" | ||
visit_model = "meta_subject.subjectvisit" | ||
history_button_label = _("Audit") | ||
|
||
def get_context_data(self, **kwargs) -> dict[str, Any]: | ||
context = super().get_context_data(**kwargs) | ||
try: | ||
Endpoints.objects.get(subject_identifier=self.subject_identifier) | ||
except ObjectDoesNotExist: | ||
pass | ||
else: | ||
url = reverse("meta_reports_admin:meta_reports_glucosesummary_changelist") | ||
url = f"{url}?q={self.subject_identifier}" | ||
message = _( | ||
format_html( | ||
f"Subject has reached the protocol endpoint. " | ||
f'See <A href="{url}">{GlucoseSummary._meta.verbose_name}</A>' | ||
) | ||
) | ||
self.message_user(message, level=messages.WARNING) | ||
return context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters