This commit is contained in:
stupidcomputer 2024-06-29 23:54:25 -05:00
parent 39e81d5727
commit ff92a221f1
4 changed files with 17 additions and 20 deletions

View File

@ -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,

View File

@ -1,14 +0,0 @@
{% extends "explorer/base.html" %}
{% block content %}
<link rel="stylesheet" type="text/css" href="/static/tn.css" />
<div class="boxed">
<h1>All bills by {{ school_name }}</h1>
<ul>
{% for text in legislation %}
<li><a href="/explorer/legislation/{{ text.id }}">{{ text.legislation_title }}</a></li>
{% endfor %}
</ul>
</div>
{% endblock content %}

View File

@ -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()
})