Skip to content

Commit

Permalink
[#1109] Fixed pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
vaszig committed Feb 10, 2023
1 parent 0df2d16 commit a0f80bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/open_inwoner/plans/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,16 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
user = self.request.user

plans = self.get_queryset()
paginator, page, queryset, is_paginated = self.paginate_queryset(plans, 10)
context["paginator"] = paginator
context["page_obj"] = page
context["is_paginated"] = is_paginated
context["plans"] = queryset

if user.contact_type == ContactTypeChoices.begeleider:
plans = {}
for plan in self.get_queryset():
for plan in queryset:
plans[plan] = plan.get_other_users_full_names(user=user)

context["extended_plans"] = plans
Expand Down
6 changes: 3 additions & 3 deletions src/open_inwoner/templates/pages/plans/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ <h1 class="h1">
</tbody>
</table>

{% pagination page_obj=page_obj paginator=paginator request=request %}
{% else %}
{% card_container plans=object_list columns=2 %}
{% card_container plans=plans columns=2 %}
{% endif %}


{% pagination page_obj=page_obj paginator=paginator request=request %}
{% endblock %}

0 comments on commit a0f80bd

Please sign in to comment.