tiktuk
tiktuk

Reputation: 505

Django-endless-pagination fails when using template inheritance

Django Endless Pagination works perfectly fine right until I use template inheritance.

views.py:

from django.shortcuts import render

def home(request):
    objects = range(30)

    return render(request,
        'index.html',
        locals()
    )

index.html:

{% extends "root.html" %}

{% load endless %}

{% paginate objects %}
{% block content %}
    {{ objects }}
    <br/>
    <br/>
    {% show_pages %}
{% endblock %}

root.html:

<div class="content">
    {% block content %}{% endblock %}
</div>

If I uncomment the line {% extends "root.html" %} in index.html it works. Otherwise I get the following error:

Error during template rendering

In template /Users/tuk/Desktop/endlesstest/templates/index.html, error at line 10
Cannot find endless page in context.

1   {% extends "root.html" %}
2   
3   {% load endless %}
4   
5   {% paginate objects %}
6   {% block content %}
7       {{ objects }}
8       <br/>
9       <br/>
10      {% show_pages %}
11  {% endblock %}

Upvotes: 0

Views: 1389

Answers (1)

Goin
Goin

Reputation: 3974

This line only execute when this template is into a block or this template does not extends to other

{% load endless %}

Do you install the app in your settings?

Upvotes: 1

Related Questions