Skip to content

Commit

Permalink
Merge pull request #178 from tm-kn/use-the-same-way-as-wagtail-to-cou…
Browse files Browse the repository at this point in the history
…nt-pages

Use Wagtail's logic in the page count in the dash
  • Loading branch information
jberghoef committed May 30, 2018
2 parents 0f5501c + 4e5454b commit 037381f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/wagtail_personalisation/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,11 @@ def get_context(self):
context = super(CorrectedPagesSummaryPanel, self).get_context()

pages = utils.exclude_variants(Page.objects.all().specific())

context['total_pages'] = len(pages) - 1
context['total_pages'] = len(pages)
# Perform the same check as Wagtail to get the correct count.
# https://github.com/wagtail/wagtail/blob/5c9ff23e229acabad406c42c4e13cbaea32e6c15/wagtail/admin/site_summary.py#L38
if context.get('root_page') and context['root_page'].is_root():
context['total_pages'] -= 1
return context


Expand Down

0 comments on commit 037381f

Please sign in to comment.