diff --git a/ynr/apps/candidates/views/people.py b/ynr/apps/candidates/views/people.py index aa638b654..4699d81fa 100644 --- a/ynr/apps/candidates/views/people.py +++ b/ynr/apps/candidates/views/people.py @@ -30,7 +30,6 @@ PersonMembershipFormsetFactory, ) from people.models import Person -from people.splitting import PersonSplitter from popolo.models import NotStandingValidationError from ynr.apps.people.merging import InvalidMergeError, PersonMerger diff --git a/ynr/apps/elections/uk/templates/candidates/person-view.html b/ynr/apps/elections/uk/templates/candidates/person-view.html index 1a854f0bc..8069ba42c 100644 --- a/ynr/apps/elections/uk/templates/candidates/person-view.html +++ b/ynr/apps/elections/uk/templates/candidates/person-view.html @@ -19,7 +19,7 @@ - + {% comment %} {% endcomment %} @@ -30,7 +30,7 @@ {% if settings.TWITTER_USERNAME %} {% endif %} - + {% comment %} {% endcomment %} {% endblock %} @@ -48,7 +48,7 @@
- + {% comment %} {% endcomment %} {% if not person.person_image and user.is_authenticated %} Upload photo diff --git a/ynr/apps/people/forms/forms.py b/ynr/apps/people/forms/forms.py index 20a63e6e8..8351115c4 100644 --- a/ynr/apps/people/forms/forms.py +++ b/ynr/apps/people/forms/forms.py @@ -407,6 +407,36 @@ class UpdatePersonForm(BasePersonForm): pass +class PersonSplitForm(UpdatePersonForm): + class Meta: + model = Person + # TO DO review these exclusions + exclude = ( + "versions", + "not_standing", + "edit_limitations", + "sort_name", + ) + + SPLIT_CHOICES = [ + ("keep", "Keep on this person"), + ("move", "Add to the new person"), + ("both", "Keep on this person and add to a new person"), + ] + + split_person_choices = forms.ChoiceField( + label="What would you like to do with the information?", + choices=SPLIT_CHOICES, + widget=forms.RadioSelect, + ) + + # TO DO: Add a method to split the person + + # TO DO Add a method to update the person with the new data + + # TO DO Add a method to create a new person with the new data + + class OtherNameForm(forms.ModelForm): class Meta: model = OtherName diff --git a/ynr/apps/people/templates/people/split_person.html b/ynr/apps/people/templates/people/split_person.html new file mode 100644 index 000000000..437dfc38c --- /dev/null +++ b/ynr/apps/people/templates/people/split_person.html @@ -0,0 +1,94 @@ +{% extends 'base.html' %} +{% load thumbnail %} +{% load static %} +{% load pipeline %} + +{% block content %} +

Split {{ person.name }} into two people

+

Choose which properties to keep on the original person, which to move to the new person, and which to keep on both.

+ +
+ {% csrf_token %} + + + + + + + + + + + + + {% for radio in form.split_person_choices %} + + {% endfor %} + + + + + + {% for radio in form.split_person_choices %} + + {% endfor %} + + + + + {% for radio in form.split_person_choices %} + + {% endfor %} + + + + + {% for radio in form.split_person_choices %} + + {% endfor %} + + + + + {% for radio in form.split_person_choices %} + + {% endfor %} + + + + + {% for radio in form.split_person_choices %} + + {% endfor %} + + + + + {% for radio in form.split_person_choices %} + + {% endfor %} + + + + + {% for radio in form.split_person_choices %} + + {% endfor %} + + + + +
Keep on original?Add to new?Keep on original and add to new?Property{{person.name}}'s data
{{ radio.tag }}Name:{{person.name}}
{{ radio.tag }}Image: + {% if person.image.image %} + {% thumbnail person.image.image "100x100" as thumb %} + {{ person.name }} thumbnail + {% endthumbnail %} + {% else %} + No image exists for this person. + {% endif %} +
{{ radio.tag }}Other names:{{person.other_names.all}}
{{ radio.tag }}Gender:{{person.gender}}
{{ radio.tag }}Birth date:{{person.birth_date}}
{{ radio.tag }}Death date:{{person.death_date}}
{{ radio.tag }}Summary:{{person.summary}}
{{ radio.tag }}Biography:{{person.biography}}
+ + +
Cancel +
+{% endblock %}