diff --git a/locale/cy/LC_MESSAGES/django.po b/locale/cy/LC_MESSAGES/django.po index 33db8d14b..d130b2d20 100644 --- a/locale/cy/LC_MESSAGES/django.po +++ b/locale/cy/LC_MESSAGES/django.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-11 15:40+0100\n" +"POT-Creation-Date: 2023-06-16 12:53+0100\n" "PO-Revision-Date: 2022-03-24 09:04+0000\n" "Last-Translator: Sym Roe , 2022\n" "Language-Team: Welsh (https://www.transifex.com/democracy-club/teams/61326/" @@ -116,7 +116,7 @@ msgid "All Elections in the UK" msgstr "Pob Etholiad yn y DU" #: wcivf/apps/elections/templates/elections/elections_view.html:18 -#: wcivf/templates/base.html:107 +#: wcivf/templates/base.html:102 msgid "All Elections" msgstr "Pob Etholiad" @@ -229,7 +229,7 @@ msgstr "Rydych chi yma" #: wcivf/apps/parties/templates/parties/party_detail.html:17 #: wcivf/apps/parties/templates/parties/speaker_seeking_reelection.html:17 #: wcivf/apps/people/templates/people/person_detail.html:27 -#: wcivf/templates/base.html:106 +#: wcivf/templates/base.html:101 msgid "Home" msgstr "Cartref" @@ -331,16 +331,16 @@ msgstr "Symbol y blaid" msgid "Show %(num_candidates)s candidates" msgstr "Dangos %(num_candidates)s ymgeiswyr" -#: wcivf/apps/elections/templates/elections/includes/_person_card.html:23 +#: wcivf/apps/elections/templates/elections/includes/_person_card.html:18 msgid "Elected" msgstr "Etholwyd" -#: wcivf/apps/elections/templates/elections/includes/_person_card.html:30 +#: wcivf/apps/elections/templates/elections/includes/_person_card.html:25 #, fuzzy, python-format msgid "%(votes_cast)s votes" msgstr "%(votes_cast)s pleidlais (etholwyd)" -#: wcivf/apps/elections/templates/elections/includes/_person_card.html:38 +#: wcivf/apps/elections/templates/elections/includes/_person_card.html:33 #, python-format msgid "Photo of %(person_name)s" msgstr "Llun o %(person_name)s" @@ -1147,8 +1147,8 @@ msgid "Current: %(party_name)s" msgstr "Ar hyn o bryd: %(party_name)s" #: wcivf/apps/parties/templates/parties/independent_candidate.html:30 -#: wcivf/apps/parties/templates/parties/party_detail.html:35 -#: wcivf/apps/parties/templates/parties/party_detail.html:51 +#: wcivf/apps/parties/templates/parties/party_detail.html:38 +#: wcivf/apps/parties/templates/parties/party_detail.html:54 #: wcivf/apps/parties/templates/parties/speaker_seeking_reelection.html:30 #, fuzzy, python-format #| msgid "%(num_candidates)s candidate%(pluralize_candidates)s" @@ -1166,33 +1166,39 @@ msgid "" "\"%(ballot_name)s\", or with no description at all." msgstr "" -#: wcivf/apps/parties/templates/parties/party_detail.html:40 -#: wcivf/apps/parties/templates/parties/party_detail.html:56 -msgid "Read more on wikipedia" -msgstr "Darllenwch fwy ar wikipedia" +#: wcivf/apps/parties/templates/parties/party_detail.html:36 +#, fuzzy, python-format +#| msgid "Current: %(party_name)s" +msgid "Alternative name: %(alt_name)s" +msgstr "Ar hyn o bryd: %(party_name)s" #: wcivf/apps/parties/templates/parties/party_detail.html:43 #: wcivf/apps/parties/templates/parties/party_detail.html:59 +msgid "Read more on wikipedia" +msgstr "Darllenwch fwy ar wikipedia" + +#: wcivf/apps/parties/templates/parties/party_detail.html:46 +#: wcivf/apps/parties/templates/parties/party_detail.html:62 #, python-format msgid "" "This political party was deregistered on %(dereg_date)s, and can no longer " "field candidates. " msgstr "" -#: wcivf/apps/parties/templates/parties/party_detail.html:65 +#: wcivf/apps/parties/templates/parties/party_detail.html:68 #, fuzzy, python-format #| msgid "This election was held %(election_date)s." msgid "" "

This party %(was_is)s on the %(register)s register.

" msgstr "Cynhaliwyd yr etholiad hwn %(election_date)s" -#: wcivf/apps/parties/templates/parties/party_detail.html:76 +#: wcivf/apps/parties/templates/parties/party_detail.html:79 #, fuzzy #| msgid " %(description)s " msgid "Joint description" msgstr " %(description)s " -#: wcivf/apps/parties/templates/parties/party_detail.html:79 +#: wcivf/apps/parties/templates/parties/party_detail.html:82 #, fuzzy, python-format #| msgid "" #| "\n" @@ -1206,35 +1212,67 @@ msgstr "" "\n" " %(num_votes)s pleidlais (etholwyd)\n" -#: wcivf/apps/parties/templates/parties/party_detail.html:88 +#: wcivf/apps/parties/templates/parties/party_detail.html:91 #, python-format msgid "" "View the entry for the %(party_name)s in the register of political parties." msgstr "" -#: wcivf/apps/parties/templates/parties/party_detail.html:98 +#: wcivf/apps/parties/templates/parties/party_detail.html:101 msgid "View this party's entry in the register of political parties." msgstr "" -#: wcivf/apps/parties/templates/parties/party_detail.html:105 +#: wcivf/apps/parties/templates/parties/party_detail.html:108 #, fuzzy #| msgid " %(description)s " msgid "Ballot descriptions" msgstr " %(description)s " -#: wcivf/apps/parties/templates/parties/party_detail.html:106 +#: wcivf/apps/parties/templates/parties/party_detail.html:110 #, python-format msgid "" "This party may appear on the ballot paper as \"%(ballot_name)s\", or any of " "the following names:" msgstr "" -#: wcivf/apps/parties/templates/parties/party_detail.html:115 +#: wcivf/apps/parties/templates/parties/party_detail.html:122 +msgid "This party currently has no alternative descriptions." +msgstr "" + +#: wcivf/apps/parties/templates/parties/party_detail.html:129 +#, fuzzy +#| msgid " %(description)s " +msgid "Previous Descriptions" +msgstr " %(description)s " + +#: wcivf/apps/parties/templates/parties/party_detail.html:131 +msgid "" +"These descriptions are no longer registered with the Electoral Commission " +"and cannot be used." +msgstr "" + +#: wcivf/apps/parties/templates/parties/party_detail.html:144 #, fuzzy #| msgid "emblem" msgid "Emblems" msgstr "symbol" +#: wcivf/apps/parties/templates/parties/party_detail.html:154 +msgid "This party currently has no alternative emblems." +msgstr "" + +#: wcivf/apps/parties/templates/parties/party_detail.html:161 +#, fuzzy +#| msgid "emblem" +msgid "Previous Emblems" +msgstr "symbol" + +#: wcivf/apps/parties/templates/parties/party_detail.html:163 +msgid "" +"These emblems are no longer registered with the Electoral Commission and " +"cannot be used." +msgstr "" + #: wcivf/apps/parties/templates/parties/party_list.html:4 #: wcivf/apps/parties/templates/parties/party_list.html:5 msgid "UK Political Parties" @@ -1431,7 +1469,7 @@ msgid "%(person_name)s's home page" msgstr "Hafan %(person_name)s" #: wcivf/apps/people/templates/people/includes/_person_contact_card.html:54 -#: wcivf/templates/base.html:114 +#: wcivf/templates/base.html:110 msgid "Blog" msgstr "Blog" @@ -1535,30 +1573,30 @@ msgstr "" msgid "Ask the candidate for more information »" msgstr "Holwch yr ymgeisydd am fwy o wybodaeth »" -#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:15 +#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:12 msgid "an,a" msgstr "" -#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:15 +#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:12 #, python-format msgid "is %(a_or_an)s %(party_name)s candidate in the following elections:" msgstr "yw %(a_or_an)s ymgeisydd y %(party_name)s yn yr etholiadau canlynol:" -#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:23 +#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:20 #, python-format msgid "%(election)s for" msgstr "%(election)s ar gyfer" -#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:28 +#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:25 #, python-format msgid "%(num_votes)s votes" msgstr "%(num_votes)s pleidlais" -#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:33 +#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:30 msgid "(elected)" msgstr "(etholwyd)" -#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:51 +#: wcivf/apps/people/templates/people/includes/_person_intro_card.html:48 #, python-format msgid "profile photo of %(person)s" msgstr "Llun proffil %(person)s" @@ -1911,13 +1949,13 @@ msgstr "" "href=\"%(post_url)s\">%(post_label)s yn yr %(election_name)s." -#: wcivf/apps/people/templates/people/not_current_person_detail.html:27 +#: wcivf/apps/people/templates/people/not_current_person_detail.html:24 #, python-format msgid "%(person_name)s stood for election %(past_candidacy_count)s times." msgstr "" "Ymgeisiodd%(person_name)smewn etholiad %(past_candidacy_count)s o weithiau." -#: wcivf/apps/people/templates/people/not_current_person_detail.html:32 +#: wcivf/apps/people/templates/people/not_current_person_detail.html:29 #, python-format msgid "profile photo of %(object.name)s" msgstr "Llun proffil %(object.name)s" @@ -2032,62 +2070,68 @@ msgstr "Dim canlyniadau eto" msgid "Language:" msgstr "Iaith:" -#: wcivf/templates/base.html:108 +#: wcivf/templates/base.html:103 +#, fuzzy +#| msgid "Parties" +msgid "All Parties" +msgstr "Pleidiau" + +#: wcivf/templates/base.html:104 msgid "Standing as a candidate?" msgstr "Sefyll fel ymgeisydd?" -#: wcivf/templates/base.html:109 +#: wcivf/templates/base.html:105 #, python-format msgid "About %(SITE_TITLE)s" msgstr "Ynglŷn %(SITE_TITLE)s" -#: wcivf/templates/base.html:110 +#: wcivf/templates/base.html:106 msgid "Privacy" msgstr "Preifatrwydd" -#: wcivf/templates/base.html:111 +#: wcivf/templates/base.html:107 msgid "Source code" msgstr "Cod ffynhonnell" -#: wcivf/templates/base.html:112 +#: wcivf/templates/base.html:108 msgid "About Democracy Club" msgstr "Ynglŷn â'r Clwb Democratiaeth" -#: wcivf/templates/base.html:113 +#: wcivf/templates/base.html:109 msgid "Contact Us" msgstr "Cysylltwch â Ni" -#: wcivf/templates/base.html:115 +#: wcivf/templates/base.html:111 msgid "Twitter" msgstr "Trydar" -#: wcivf/templates/base.html:116 +#: wcivf/templates/base.html:112 msgid "GitHub" msgstr "GitHub" -#: wcivf/templates/base.html:123 +#: wcivf/templates/base.html:119 msgid "democracy" msgstr "democratiaeth" -#: wcivf/templates/base.html:123 +#: wcivf/templates/base.html:119 msgid "club" msgstr "clwb" -#: wcivf/templates/base.html:129 wcivf/templates/home.html:5 +#: wcivf/templates/base.html:125 wcivf/templates/home.html:5 #: wcivf/templates/home.html:6 msgid "Who Can I Vote For?" msgstr "Pwy alla i bleidleisio ar gyfer?" -#: wcivf/templates/base.html:133 +#: wcivf/templates/base.html:129 #, python-format msgid "Copyright © %(current_year)s" msgstr "Hawlfraint © %(current_year)s" -#: wcivf/templates/base.html:134 +#: wcivf/templates/base.html:130 msgid "Democracy Club Community Interest Company" msgstr "Cwmni Buddiannau Cymunedol y Clwb Democratiaeth" -#: wcivf/templates/base.html:135 +#: wcivf/templates/base.html:131 msgid "" "Company No: 09461226" @@ -2095,7 +2139,7 @@ msgstr "" "Rhif y Cwmni: 09461226" -#: wcivf/templates/base.html:137 +#: wcivf/templates/base.html:133 msgid "" "Democracy Club is a UK-based Community Interest Company that builds the " "digital infrastructure needed for a 21st century democracy" diff --git a/wcivf/apps/parties/management/commands/import_parties.py b/wcivf/apps/parties/management/commands/import_parties.py index d007ac84b..4491ce563 100644 --- a/wcivf/apps/parties/management/commands/import_parties.py +++ b/wcivf/apps/parties/management/commands/import_parties.py @@ -24,7 +24,8 @@ def add_party_descriptions(self, party_obj, descriptions): defaults={ "date_description_approved": description[ "date_description_approved" - ] + ], + "active": description["active"], }, ) @@ -38,6 +39,7 @@ def add_party_emblems(self, party_obj, emblems): "description": emblem["description"], "date_approved": emblem["date_approved"], "default": emblem["default"], + "active": emblem["active"], }, ) diff --git a/wcivf/apps/parties/migrations/0019_alter_partydescription_options_and_more.py b/wcivf/apps/parties/migrations/0019_alter_partydescription_options_and_more.py new file mode 100644 index 000000000..c2dc201d5 --- /dev/null +++ b/wcivf/apps/parties/migrations/0019_alter_partydescription_options_and_more.py @@ -0,0 +1,31 @@ +# Generated by Django 4.1.6 on 2023-06-14 15:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("parties", "0018_alter_partydescription_options"), + ] + + operations = [ + migrations.AlterModelOptions( + name="partydescription", + options={"ordering": ["-active", "date_description_approved"]}, + ), + migrations.AlterModelOptions( + name="partyemblem", + options={"ordering": ("-default", "-active", "ec_emblem_id")}, + ), + migrations.AddField( + model_name="partydescription", + name="active", + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name="partyemblem", + name="active", + field=models.BooleanField(default=False), + ), + ] diff --git a/wcivf/apps/parties/migrations/0020_party_alternative_name.py b/wcivf/apps/parties/migrations/0020_party_alternative_name.py new file mode 100644 index 000000000..e6eff1d91 --- /dev/null +++ b/wcivf/apps/parties/migrations/0020_party_alternative_name.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.6 on 2023-06-14 15:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("parties", "0019_alter_partydescription_options_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="party", + name="alternative_name", + field=models.CharField(max_length=765, null=True), + ), + ] diff --git a/wcivf/apps/parties/models.py b/wcivf/apps/parties/models.py index 9246a0a29..37fc19d1f 100644 --- a/wcivf/apps/parties/models.py +++ b/wcivf/apps/parties/models.py @@ -17,6 +17,7 @@ def update_or_create_from_ynr(self, party): "status": party["status"], "date_registered": party["date_registered"], "date_deregistered": party["date_deregistered"], + "alternative_name": party["alternative_name"], } if party["default_emblem"]: @@ -36,6 +37,7 @@ class Party(models.Model): party_id = models.CharField(blank=True, max_length=100, primary_key=True) party_name = models.CharField(max_length=765) + alternative_name = models.CharField(max_length=765, null=True) emblem_url = models.URLField(blank=True, null=True) wikipedia_url = models.URLField(blank=True) description = models.TextField(blank=True) @@ -168,6 +170,14 @@ def format_register(self): return None +class PartyDescriptionQuerySet(models.QuerySet): + def active(self): + return self.filter(active=True) + + def inactive(self): + return self.filter(active=False) + + class PartyDescription(TimeStampedModel): """ A party can register one or more descriptions with The Electoral Commission. @@ -182,6 +192,9 @@ class PartyDescription(TimeStampedModel): description = models.CharField(max_length=800) date_description_approved = models.DateField(null=True) + active = models.BooleanField(default=False) + + objects = PartyDescriptionQuerySet.as_manager() class Meta: unique_together = ( @@ -189,7 +202,15 @@ class Meta: "description", ) - ordering = ["date_description_approved"] + ordering = ["-active", "date_description_approved"] + + +class PartyEmblemQuerySet(models.QuerySet): + def active(self): + return self.filter(active=True) + + def inactive(self): + return self.filter(active=False) class PartyEmblem(TimeStampedModel): @@ -201,9 +222,12 @@ class PartyEmblem(TimeStampedModel): description = models.CharField(max_length=255) date_approved = models.DateField(null=True) default = models.BooleanField(default=False) + active = models.BooleanField(default=False) + + objects = PartyEmblemQuerySet.as_manager() class Meta: - ordering = ("-default", "ec_emblem_id") + ordering = ("-default", "-active", "ec_emblem_id") class LocalParty(TimeStampedModel): diff --git a/wcivf/apps/parties/templates/parties/party_detail.html b/wcivf/apps/parties/templates/parties/party_detail.html index 89c018429..4c10161c2 100644 --- a/wcivf/apps/parties/templates/parties/party_detail.html +++ b/wcivf/apps/parties/templates/parties/party_detail.html @@ -32,6 +32,9 @@

{{ object.format_name }}

+ {% if object.alternative_name %} +

{% blocktrans with alt_name=object.alternative_name %}Alternative name: {{ alt_name }}{% endblocktrans %}

+ {% endif %}

{% blocktrans with num_candidates=object.personpost_set.all.count|intcomma pluralize_candidates=object.personpost_set.all.count|pluralize %}{{ num_candidates }} candidate{{ pluralize_candidates }} in our database.{% endblocktrans %}

{% if object.description %} {{ object.description|markdown }} @@ -101,25 +104,72 @@

{% endif %} {% endif %} - {% if object.party_descriptions.all %} -

{% trans "Ballot descriptions" %}

+ +

{% trans "Ballot descriptions" %}

+ {% if object.alternative_name or object.party_descriptions.active %}

{% blocktrans trimmed with ballot_name=object.party_name %} This party may appear on the ballot paper as "{{ ballot_name }}", or any of the following names:{% endblocktrans %}

+ {% else %} +

{% trans "This party currently has no alternative descriptions registered with the Electoral Commission." %}

{% endif %} + {% if object.party_descriptions.inactive %} + + {% endif %} + - {% if object.emblems.all %} -

{% trans "Emblems" %}

+

{% trans "Emblems" %}

+ {% if object.emblems.active %} + {% else %} +

{% trans "This party currently has no alternative emblems registered with the Electoral Commission." %}

+ {% endif %} + {% if object.emblems.inactive %} + {% endif %}
diff --git a/wcivf/apps/parties/tests/test_import_parties.py b/wcivf/apps/parties/tests/test_import_parties.py index 7dff46e4a..c09318fc6 100644 --- a/wcivf/apps/parties/tests/test_import_parties.py +++ b/wcivf/apps/parties/tests/test_import_parties.py @@ -11,6 +11,7 @@ "ec_id": "PP01", "url": "https://candidates.democracyclub.org.uk/api/next/parties/PP6673/", "name": "Wombles Alliance", + "alternative_name": "Cynghrair Wombles", "register": "GB", "status": "Registered", "date_registered": "2018-01-31", diff --git a/wcivf/templates/base.html b/wcivf/templates/base.html index d2e37d251..5cdd58b93 100644 --- a/wcivf/templates/base.html +++ b/wcivf/templates/base.html @@ -100,6 +100,7 @@