How to use the feincms3.shortcuts.render_list function in feincms3

To help you get started, we’ve selected a few feincms3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matthiask / feincms3 / tests / testapp / articles_urls.py View on Github external
def article_list(request):
    page = page_for_app_request(request)
    page.activate_language(request)
    return render_list(
        request,
        Article.objects.filter(category=page.application),
        {"page": page},
        paginate_by=5,
    )
github matthiask / feincms3 / tests / testapp / test_feincms3.py View on Github external
def test_render_list(self):
        for i in range(7):
            Article.objects.create(title="Article %s" % i, category="publications")

        request = RequestFactory().get("/", data={"page": 2})
        response = render_list(
            request, list(Article.objects.all()), model=Article, paginate_by=2
        )

        self.assertEqual(response.template_name, "testapp/article_list.html")
        self.assertEqual(len(response.context_data["object_list"]), 2)
        self.assertEqual(response.context_data["object_list"].number, 2)
        self.assertEqual(response.context_data["object_list"].paginator.num_pages, 4)
github matthiask / feincms3 / tests / testapp / articles_urls.py View on Github external
def article_list_all(request):
    page = page_for_app_request(request)
    page.activate_language(request)
    return render_list(
        request, Article.objects.filter(category=page.application), {"page": page}
    )
github matthiask / feincms3-example / app / articles / views.py View on Github external
def article_list(request):
    page = page_for_app_request(request)
    page.activate_language(request)
    return render_list(
        request,
        # Only show articles for the current app.
        Article.objects.published().filter(
            category=page.application,
        ).prefetch_related('images'),
        {'page': page},
        paginate_by=10,
    )