Skip to content
This repository was archived by the owner on Mar 15, 2018. It is now read-only.

Commit 13ffdeb

Browse files
committed
just get the size of the query for profile page (bug 860407)
1 parent d8a2724 commit 13ffdeb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

apps/users/models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ def addons_listed(self):
174174
return self.addons.reviewed().exclude(type=amo.ADDON_WEBAPP).filter(
175175
addonuser__user=self, addonuser__listed=True)
176176

177+
@amo.cached_property
178+
def num_addons_listed(self):
179+
"""Number of public add-ons this user is listed as author of."""
180+
return self.addons.reviewed().exclude(type=amo.ADDON_WEBAPP).filter(
181+
addonuser__user=self, addonuser__listed=True).count()
182+
177183
@amo.cached_property
178184
def apps_listed(self):
179185
"""Public apps this user is listed as author of."""

apps/users/templates/users/vcard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
{{ _('Number of add-ons developed') }}
4040
</th>
4141
<td class="num-addons">
42-
{% with num=profile.addons_listed|length %}
42+
{% with num=profile.num_addons_listed %}
4343
{% if num == 0 %}
4444
{{ _('{0} add-ons')|f(num) }}
4545
{% else %}

0 commit comments

Comments
 (0)