From 74bc6f58899fa0366a520d593a3fc56b949e778c Mon Sep 17 00:00:00 2001 From: Virginia Dooley Date: Thu, 30 May 2024 11:04:54 +0100 Subject: [PATCH] Review split person choices --- ynr/apps/candidates/views/people.py | 5 +- .../templates/people/review_split_person.html | 56 +++++++++++-------- ynr/apps/people/urls.py | 5 ++ 3 files changed, 43 insertions(+), 23 deletions(-) diff --git a/ynr/apps/candidates/views/people.py b/ynr/apps/candidates/views/people.py index 160c588ec..c62f3a84f 100644 --- a/ynr/apps/candidates/views/people.py +++ b/ynr/apps/candidates/views/people.py @@ -582,11 +582,14 @@ def post(self, request, *args, **kwargs): class ReviewPersonSplitView(TemplateView): - template_name = "review_split_person.html" + template_name = "people/review_split_person.html" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["choices"] = self.request.session.get("choices", {}) + context["person"] = get_object_or_404( + Person, pk=self.request.session.get("person_id") + ) return context diff --git a/ynr/apps/people/templates/people/review_split_person.html b/ynr/apps/people/templates/people/review_split_person.html index 4c6d33566..05e579b38 100644 --- a/ynr/apps/people/templates/people/review_split_person.html +++ b/ynr/apps/people/templates/people/review_split_person.html @@ -4,28 +4,40 @@ {% load pipeline %} {% block content %} -

Review Person split choices

-

Keep

- -

Move

- -

Both

- -
+

Review split person choices

+ + {% if choices.keep %} +

Keep these attributes on Person:# {{person_id}}

+ +

Submitting this form will create a new person with the above attributes.

+ {% endif %} + + {% if choices.move %} +

Move these attributes to a new Person

+ +

Submitting this form will create a new person with the above attributes and remove the above attributes from the original person.

+ {% endif %} + + {% if choices.both %} +

Do both

+ +

Submitting this form will create a new person with the above attributes and keep the above attributes on the original person.

+ {% endif %} + {% csrf_token %} - +
- + Go back {% endblock %} diff --git a/ynr/apps/people/urls.py b/ynr/apps/people/urls.py index 01a12124e..18026e95a 100644 --- a/ynr/apps/people/urls.py +++ b/ynr/apps/people/urls.py @@ -57,6 +57,11 @@ views.ReviewPersonSplitView.as_view(), name="review_split_person", ), + re_path( + r"^person/(?P\d+)/confirm_split/?$", + views.ConfirmPersonSplitView.as_view(), + name="confirm_split_person", + ), re_path( r"^person/create/select_election$", views.NewPersonSelectElectionView.as_view(),