Skip to content

Commit e0122c0

Browse files
committed
AppointmentMixin adds presented_appointment to context
1 parent 02f05ed commit e0122c0

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

manage_breast_screening/mammograms/views/appointment_views.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,22 @@ class ConfirmIdentity(InProgressAppointmentMixin, TemplateView):
122122
template_name = "mammograms/confirm_identity.jinja"
123123

124124
def get_context_data(self, pk, **kwargs):
125+
context = super().get_context_data()
126+
125127
participant = self.appointment.participant
126128

127-
appointment_presenter = AppointmentPresenter(
128-
self.appointment, tab_description="Appointment details"
129+
context.update(
130+
{
131+
"heading": "Confirm identity",
132+
"page_title": "Confirm identity",
133+
"presented_participant": ParticipantPresenter(participant),
134+
"appointment_cannot_proceed_href": reverse(
135+
"mammograms:appointment_cannot_go_ahead", kwargs={"pk": pk}
136+
),
137+
},
129138
)
130-
return {
131-
"heading": "Confirm identity",
132-
"page_title": "Confirm identity",
133-
"presented_participant": ParticipantPresenter(participant),
134-
"presented_appointment": appointment_presenter,
135-
"appointment_cannot_proceed_href": reverse(
136-
"mammograms:appointment_cannot_go_ahead", kwargs={"pk": pk}
137-
),
138-
}
139+
140+
return context
139141

140142
def post(self, request, pk):
141143
return redirect("mammograms:ask_for_medical_information", pk=pk)

manage_breast_screening/mammograms/views/mixins.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
from rules.contrib.views import PermissionRequiredMixin
66

77
from manage_breast_screening.auth.models import Permission
8+
from manage_breast_screening.mammograms.presenters.appointment_presenters import (
9+
AppointmentPresenter,
10+
)
811
from manage_breast_screening.participants.models import Appointment
912

1013

@@ -33,6 +36,17 @@ def appointment(self):
3336
def participant(self):
3437
return self.appointment.participant
3538

39+
def get_context_data(self, **kwargs):
40+
context = super().get_context_data(**kwargs)
41+
42+
context.update(
43+
{
44+
"presented_appointment": AppointmentPresenter(self.appointment),
45+
},
46+
)
47+
48+
return context
49+
3650

3751
class InProgressAppointmentMixin(PermissionRequiredMixin, AppointmentMixin):
3852
"""

0 commit comments

Comments
 (0)