diff --git a/franklincce/explorer/models.py b/franklincce/explorer/models.py
index 5f0f5ff..7db53e5 100644
--- a/franklincce/explorer/models.py
+++ b/franklincce/explorer/models.py
@@ -168,8 +168,8 @@ class LegislativeText(models.Model):
class LegislationClassification(models.Model):
class Meta:
- verbose_name = "Classification"
- verbose_name_plural = "Classifications"
+ verbose_name = "Topic"
+ verbose_name_plural = "Topics"
name = models.CharField(max_length=256, help_text="Name of this classification.")
text_to_match = models.CharField(
@@ -179,3 +179,7 @@ class LegislationClassification(models.Model):
def __str__(self):
return "{}".format(self.name)
+
+ def get_absolute_url(self):
+ our_name = __class__.__name__
+ return reverse("{}.detail".format(our_name), kwargs={"model_id": self.id})
\ No newline at end of file
diff --git a/franklincce/explorer/templates/explorer/by_group.html b/franklincce/explorer/templates/explorer/by_group.html
index 307f20a..d13530b 100644
--- a/franklincce/explorer/templates/explorer/by_group.html
+++ b/franklincce/explorer/templates/explorer/by_group.html
@@ -9,6 +9,7 @@
{% endblock content %}
\ No newline at end of file
diff --git a/franklincce/explorer/urls.py b/franklincce/explorer/urls.py
index 146f4f1..d4850fb 100644
--- a/franklincce/explorer/urls.py
+++ b/franklincce/explorer/urls.py
@@ -8,8 +8,8 @@ urlpatterns = [
path("stats/", views.stats, name="stats"),
path("legislation//", views.view_legislation, name="viewleg"),
path("conference//", views.view_conference, name="viewconf"),
- path("topics//", views.get_all_classified_by_id, name="classificationview"),
- path("topics/", views.get_all_classifications, name="classificationsview"),
+ path("topics//", views.get_all_classified_by_id, name="LegislationClassification.detail"),
+ path("topics/", views.get_all_classifications, name="LegislationClassification"),
# these are named weirdly -- see models.py School and Country definitions
path("schools//", views.get_all_by_school, name="School.detail"),
diff --git a/franklincce/explorer/views.py b/franklincce/explorer/views.py
index 285eafe..1c64100 100644
--- a/franklincce/explorer/views.py
+++ b/franklincce/explorer/views.py
@@ -54,14 +54,8 @@ def stats(request):
}
return render(request, "explorer/stats.html", context)
-def get_all_classifications(request):
- classifications = LegislationClassification.objects.all()
- return render(request, "explorer/classifications.html", {
- "classifications": classifications,
- })
-
-def get_all_classified_by_id(request, classification_id):
- classification = get_object_or_404(LegislationClassification, pk=classification_id)
+def get_all_classified_by_id(request, model_id):
+ classification = get_object_or_404(LegislationClassification, pk=model_id)
# this is very expensive; make a way for this to be cached please?
all_texts = LegislativeText.objects.all()
@@ -116,4 +110,5 @@ get_all_by_school = get_all_by_x(School)
get_all_by_country = get_all_by_x(Country)
get_all_schools = get_all_xs(School)
-get_all_countries = get_all_xs(Country)
\ No newline at end of file
+get_all_countries = get_all_xs(Country)
+get_all_classifications = get_all_xs(LegislationClassification)
\ No newline at end of file