diff --git a/hub/models.py b/hub/models.py index 8373e882d..b41e37a91 100644 --- a/hub/models.py +++ b/hub/models.py @@ -419,11 +419,34 @@ class AreaType(models.Model): ("single_tier_council", "Single Tier Council"), ("district_council", "District Council"), ] + + NAMES_SINGULAR = { + "WMC": "current constituency", + "WMC23": "future constituency", + "STC": "single tier council", + "DIS": "district council", + } + + NAMES_PLURAL = { + "WMC": "current constituencies", + "WMC23": "future constituencies", + "STC": "single tier councils", + "DIS": "district councils", + } + name = models.CharField(max_length=50, unique=True) code = models.CharField(max_length=10, unique=True) area_type = models.CharField(max_length=50, choices=AREA_TYPES) description = models.CharField(max_length=300) + @property + def name_singular(self): + return self.NAMES_SINGULAR[self.code] + + @property + def name_plural(self): + return self.NAMES_PLURAL[self.code] + def __str__(self): return self.code diff --git a/hub/templates/hub/includes/comma.html b/hub/templates/hub/includes/comma.html new file mode 100644 index 000000000..c79fe31f1 --- /dev/null +++ b/hub/templates/hub/includes/comma.html @@ -0,0 +1 @@ +{% if not forloop.first %}{% if forloop.last %} and {% else %}, {% endif %}{% endif %} diff --git a/hub/templates/hub/sources.html b/hub/templates/hub/sources.html index 2634d070f..d57ea9df7 100644 --- a/hub/templates/hub/sources.html +++ b/hub/templates/hub/sources.html @@ -51,6 +51,8 @@