def _selectable_products_inline(request, product): """Updates the product navigation on the left when variants added or updated. """ # Somewhat ugly but it works for now. This is will be updated if the # planned refactoring of the whole product management takes place from lfs.manage.product.product import selectable_products_inline from lfs.manage.product.product import _get_filtered_products_for_product_view from lfs.manage.product.product import get_current_page from django.core.paginator import Paginator AMOUNT = 20 products = _get_filtered_products_for_product_view(request) paginator = Paginator(products, AMOUNT) temp = product.parent if product.is_variant() else product page = get_current_page(request, products, temp, AMOUNT) try: page = paginator.page(page) except EmptyPage: page = paginator.page(1) return selectable_products_inline(request, page, paginator, product.id)
def _selectable_products_inline(request, product): """Updates the product navigation on the left when variants added or updated. """ # Somewhat ugly but it works for now. This is will be updated if the # planned refactoring of the whole product management takes place from lfs.manage.product.product import selectable_products_inline from lfs.manage.product.product import _get_filtered_products_for_product_view from lfs.manage.product.product import get_current_page from django.core.paginator import Paginator AMOUNT = 20 products = _get_filtered_products_for_product_view(request) paginator = Paginator(products, AMOUNT) temp = product.get_parent() page = get_current_page(request, products, temp, AMOUNT) try: page = paginator.page(page) except EmptyPage: page = paginator.page(1) return selectable_products_inline(request, page, paginator, product.id)