diff --git a/franklincce/explorer/admin.py b/franklincce/explorer/admin.py index 441718f..a034f2f 100644 --- a/franklincce/explorer/admin.py +++ b/franklincce/explorer/admin.py @@ -14,6 +14,7 @@ to_register = [ [models.LegislationClassification], [models.School], [models.Country], + [models.Sponsor], ] for i in to_register: admin.site.register(*i) \ No newline at end of file diff --git a/franklincce/explorer/models.py b/franklincce/explorer/models.py index 7423be2..6bdbfa5 100644 --- a/franklincce/explorer/models.py +++ b/franklincce/explorer/models.py @@ -106,7 +106,7 @@ class LegislationBook(models.Model): text["country"] = InstantiateIfNone(Country, text["country"]) sponsors = text["sponsors"].split(', ') - sponsors = [InstantiateIfNone(Sponsor, i) for i in sponsors] + sponsors = [InstantiateIfNone(Sponsor, sponsor) for sponsor in sponsors] del text["sponsors"] @@ -114,7 +114,7 @@ class LegislationBook(models.Model): text.save() for sponsor in sponsors: - text.upgraded_sponsors.add(sponsor) + text.sponsors.add(sponsor) def __str__(self): return "{}".format(self.name) @@ -149,7 +149,7 @@ class LegislativeText(models.Model): category = models.CharField(max_length=256) docket_order = models.IntegerField() school = models.ForeignKey(School, on_delete=models.CASCADE) - sponsors = models.ManyToManyField(Sponsor) + sponsors = models.ManyToManyField(Sponsor, blank=True) from_book = models.ForeignKey(LegislationBook, on_delete=models.CASCADE) legislation_title = models.CharField(max_length=512) country = models.ForeignKey(Country, on_delete=models.CASCADE, null=True) diff --git a/franklincce/explorer/templates/explorer/by_group.html b/franklincce/explorer/templates/explorer/by_group.html index d13530b..7a79121 100644 --- a/franklincce/explorer/templates/explorer/by_group.html +++ b/franklincce/explorer/templates/explorer/by_group.html @@ -10,6 +10,7 @@
{{ legislation.assembly }}/{{ legislation.committee }}/{{ legislation.docket_order }}
-Sponsored by {{ legislation.sponsors }} of {{ legislation.school }}
+Sponsored by + {% for sponsor in legislation.sponsors.all %} + {{ sponsor.name }}{% if not forloop.last %}, {% endif %} + {% endfor %} + + of {{ legislation.school }}
{% if legislation.country %}The delegates above represented the Delegation of {{ legislation.country }}.
diff --git a/franklincce/explorer/urls.py b/franklincce/explorer/urls.py index d4850fb..c334dba 100644 --- a/franklincce/explorer/urls.py +++ b/franklincce/explorer/urls.py @@ -14,7 +14,9 @@ urlpatterns = [ # these are named weirdly -- see models.py School and Country definitions path("schools/