diff --git a/franklincce/explorer/models.py b/franklincce/explorer/models.py index d857014..29972c9 100644 --- a/franklincce/explorer/models.py +++ b/franklincce/explorer/models.py @@ -36,6 +36,10 @@ class Country(models.Model): return self.name class LegislationBook(models.Model): + class Meta: + verbose_name = "Book" + verbose_name_plural = "Books" + class ConferenceType(models.TextChoices): MIDDLE = "M", _("Middle School") HIGH = "H", _("High School") @@ -88,6 +92,10 @@ class LegislationBook(models.Model): return "{}".format(self.name) class LegislativeText(models.Model): + class Meta: + verbose_name = "Legislation" + verbose_name_plural = "Legislation" + class Assemblies(models.TextChoices): RGA = "RGA", _("Red General Assembly") BGA = "BGA", _("Blue General Assembly") @@ -112,7 +120,7 @@ class LegislativeText(models.Model): committee = models.IntegerField() category = models.CharField(max_length=256) docket_order = models.IntegerField() - school = models.ForeignKey(School, on_delete=models.SET_NULL, null=True) + school = models.ForeignKey(School, on_delete=models.CASCADE) sponsors = models.CharField(max_length=256) from_book = models.ForeignKey(LegislationBook, on_delete=models.CASCADE) legislation_title = models.CharField(max_length=512) @@ -150,6 +158,10 @@ class LegislativeText(models.Model): return False class LegislationClassification(models.Model): + class Meta: + verbose_name = "Classification" + verbose_name_plural = "Classifications" + name = models.CharField(max_length=256, help_text="Name of this classification.") text_to_match = models.CharField( max_length=256, diff --git a/franklincce/explorer/templates/explorer/school.html b/franklincce/explorer/templates/explorer/school.html deleted file mode 100644 index 1237684..0000000 --- a/franklincce/explorer/templates/explorer/school.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "explorer/base.html" %} - -{% block content %} - -
-

All bills by {{ school_name }}

- - -
-{% endblock content %} diff --git a/franklincce/explorer/views.py b/franklincce/explorer/views.py index 75c730d..9dcb793 100644 --- a/franklincce/explorer/views.py +++ b/franklincce/explorer/views.py @@ -81,12 +81,11 @@ def get_all_classified_by_id(request, classification_id): "result_name": "All legislation in topic {}".format(classification.name) }) - def get_all_by_school(request, school_id): school = get_object_or_404(School, pk=school_id) - return render(request, "explorer/school.html", { - "school_name": school.name, + return render(request, "explorer/results.html", { + "result_name": "All legislation by {}".format(school.name), "legislation": school.legislativetext_set.all() }) @@ -94,6 +93,6 @@ def get_all_by_country(request, country_id): country = get_object_or_404(Country, pk=country_id) return render(request, "explorer/results.html", { - "result_name": "All bills by country {}".format(country.name), + "result_name": "All legislation by country {}".format(country.name), "legislation": country.legislativetext_set.all() })