diff --git a/config/tests/mixins.py b/config/tests/mixins.py index 924175b..b695108 100644 --- a/config/tests/mixins.py +++ b/config/tests/mixins.py @@ -22,16 +22,7 @@ class TestUserAuthenticationMixin: self.setup_user_permissions() def login(self): - response = self.client.post( - "/api/v1/auth/login/", - { - "username": self.user.username, - "password": self.password, - }, - ) - - jwt_token = response.data.get("access") - self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {jwt_token}") + self.client.force_login(self.user) def setup_user_permissions(self): self.create_permission = Permission.objects.get( diff --git a/web/templates/web/index.html b/web/templates/web/index.html index 7939572..5cea275 100644 --- a/web/templates/web/index.html +++ b/web/templates/web/index.html @@ -13,21 +13,12 @@ hx-swap="innerHTML" >
- +
+ +
+
- +
diff --git a/web/templates/web/list_products.html b/web/templates/web/list_products.html index d1b0d49..94171f7 100644 --- a/web/templates/web/list_products.html +++ b/web/templates/web/list_products.html @@ -1,7 +1,38 @@ {% load i18n %} {% load static %} -{% for product in products %} -
  • - {% include 'components/product_card.html' %} -
  • -{% endfor %} + + +{% if has_previous_page %} + +{% endif %} +{% if has_next_page %} + +{% endif %} diff --git a/web/views.py b/web/views.py index bd27139..700a931 100644 --- a/web/views.py +++ b/web/views.py @@ -22,10 +22,12 @@ class ListProducts(TemplateView, FilteredQuerysetMixin, PaginatedQuerysetMixin): def get_context_data(self, **kwargs): qs = self.get_queryset() - products = self.get_paginated_queryset(qs) + page = self.get_paginated_queryset(qs) return { - "products": products, + "page": page, + "has_next_page": page.has_next(), + "has_previous_page": page.has_previous(), }