diff --git a/hub/templates/hub/area.html b/hub/templates/hub/area.html index 7a0ec20df..41902aa6e 100644 --- a/hub/templates/hub/area.html +++ b/hub/templates/hub/area.html @@ -86,8 +86,33 @@

MP

{% include 'hub/area/_mp_data.html' with mp_data=mp %} + {% elif area_type == "WMC23" %} +
+

MP

+
+
+
Prospective Parliamentary Candidates
+ + + + + + + + + {% for row in PPCs %} + + + + + {% endfor %} + +
PPCParty
{{ row.person }}{{ row.party }}
+
+
{% endif %} + {% if categories.opinion %}

Public opinion

diff --git a/hub/views/area.py b/hub/views/area.py index ea0b6f1d4..d166931b9 100644 --- a/hub/views/area.py +++ b/hub/views/area.py @@ -11,6 +11,7 @@ AreaData, AreaType, DataSet, + DataType, Person, PersonData, UserDataSets, @@ -200,13 +201,22 @@ def get_context_data(self, **kwargs): context["overlap_constituencies"] = self.get_overlap_info() context["area_type"] = str(self.object.area_type) + if context["area_type"] == "WMC23": + context["PPCs"] = [ + { + "person": p, + "party": PersonData.objects.get( + person=p, data_type=DataType.objects.get(name="party") + ).value(), + } + for p in Person.objects.filter(area=self.object, person_type="PPC") + ] try: context["mp"] = { "person": Person.objects.get( area=self.object, person_type="MP", end_date__isnull=True ) } - data = PersonData.objects.filter( person=context["mp"]["person"] ).select_related("data_type")