Skip to content

Commit

Permalink
Prefetch more data (#368)
Browse files Browse the repository at this point in the history
* Prefetch more data
* Remove broken template cache
  • Loading branch information
danniel authored Nov 27, 2024
1 parent c395c39 commit 093bc1e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 0 additions & 2 deletions backend/hub/templates/hub/candidate/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ <h2 class="section-title uppercase">
<div class="container">
{% if page_obj %}

{% cache listing_cache_duration "candidate_listing" %}
<div class="is-multiline infinite-container">

{% if not SINGLE_DOMAIN_ROUND %}
Expand All @@ -69,7 +68,6 @@ <h2 class="section-title uppercase">
{% include "hub/candidate/components/listing_detail.html" %}
{% endif %}
</div>
{% endcache %}

{% endif %}
</div>
Expand Down
22 changes: 15 additions & 7 deletions backend/hub/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,17 +534,25 @@ class CandidateListView(SearchMixin):

@classmethod
def get_candidates_to_vote(cls):
return Candidate.objects_with_org.filter(
org__status=Organization.STATUS.accepted,
status=Candidate.STATUS.confirmed,
is_proposed=True,
return (
Candidate.objects_with_org.filter(
org__status=Organization.STATUS.accepted,
status=Candidate.STATUS.confirmed,
is_proposed=True,
)
.select_related("org")
.prefetch_related("domain")
)

@classmethod
def get_candidates_pending(cls):
return Candidate.objects_with_org.filter(
org__status=Organization.STATUS.accepted,
is_proposed=True,
return (
Candidate.objects_with_org.filter(
org__status=Organization.STATUS.accepted,
is_proposed=True,
)
.select_related("org")
.prefetch_related("domain")
)

def get_qs(self):
Expand Down

0 comments on commit 093bc1e

Please sign in to comment.