Skip to content

Commit

Permalink
[#1940] Fix organisations list performance
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Dec 3, 2015
1 parent 49b43c2 commit e984a58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions akvo/rsr/views/organisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ def directory(request):
# Get related objects of page at once
page.object_list = page.object_list.select_related(
'primary_location__country',
).annotate(
num_employees=Count('employees', distinct=True),
num_projects=Count('projects', distinct=True),
num_updates=Count('projects__project_updates', distinct=True),
)

return render(request, 'organisation_directory.html', {
Expand Down
6 changes: 3 additions & 3 deletions akvo/templates/organisation_directory.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ <h1><a href="{% url 'organisation-main' o.id %}"><i class="fa fa-users"></i> {{o
</div>
<div class="col-sm-3 hidden-xs hidden-sm additionalInfo">
<h4 class="detailedInfo">{% trans "Additional Information" %}</h4>
<div class=""><i class="fa fa-folder-o"></i> <span>{{o.num_projects}} {% trans "projects" %}</span></div>
<div class=""><i class="fa fa-user"></i> <span>{{o.num_employees}} {% trans "users" %}</span></div>
<div class=""><i class="fa fa-camera-retro"></i> <span>{{o.num_updates}} {% trans "updates" %}</span></div>
<div class=""><i class="fa fa-folder-o"></i> <span>{{o.all_projects.count}} {% trans "projects" %}</span></div>
<div class=""><i class="fa fa-user"></i> <span>{{o.all_users.count}} {% trans "users" %}</span></div>
<div class=""><i class="fa fa-camera-retro"></i> <span>{{o.all_updates.count}} {% trans "updates" %}</span></div>
</div>
{% if o.facebook or o.twitter or o.linkedin %}
<div class="col-md-3 hidden-xs hidden-sm">
Expand Down

0 comments on commit e984a58

Please sign in to comment.