Skip to content

Commit

Permalink
reduces db queries for taxonomies
Browse files Browse the repository at this point in the history
  • Loading branch information
actlikewill committed Jul 7, 2023
1 parent e7a4e0f commit 529cf98
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion liiweb/views/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_context_data(self, **kwargs):
context["recent_legislation"] = Legislation.objects.filter(
metadata_json__stub=False
).order_by("-date")[:10]
context["taxonomies"] = Taxonomy.get_tree()
context["taxonomies"] = Taxonomy.get_root_nodes()
context["recent_articles"] = (
Article.objects.prefetch_related("topics")
.filter(published=True)
Expand Down
2 changes: 1 addition & 1 deletion peachjam/templates/peachjam/_taxonomy_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% if taxonomies|length > 0 %}
<div class="row">
{% for taxonomy in taxonomies %}
{% if taxonomy.is_root and taxonomy.get_children|length > 0 %}
{% if taxonomy.is_root and taxonomy.get_children_count > 0 %}
<div class="col-12 col-lg-6 mb-4">
<div class="card">
<div class="card-header">{{ taxonomy }}</div>
Expand Down

0 comments on commit 529cf98

Please sign in to comment.