Skip to content

Commit

Permalink
Show the total count as a reset link #3
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Dec 21, 2023
1 parent 33902a8 commit 44187ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
</form>
</li>
<li class="nav-item">
<div class="h6 mt-2 mb-0 smaller">{{ page_obj.paginator.count|intcomma }} results</div>
<div class="h6 mt-2 mb-0 smaller">
{% if page_obj.paginator.count != inventory_count %}
{{ page_obj.paginator.count|intcomma }} of
<a href="?all=true#inventory">{{ inventory_count|intcomma }} results</a>
{% else %}
{{ page_obj.paginator.count|intcomma }} results
{% endif %}
</div>
</li>
</ul>
</div>
Expand Down
4 changes: 4 additions & 0 deletions product_portfolio/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@ def get_context_data(self, **kwargs):
user = self.request.user
dataspace = user.dataspace

productcomponents_count = self.object.productcomponents.count()
productpackages_count = self.object.productpackages.count()
context["inventory_count"] = productcomponents_count + productpackages_count

filter_productpackage = ProductPackageFilterSet(
self.request.GET,
queryset=self.object.productpackages,
Expand Down

0 comments on commit 44187ed

Please sign in to comment.