Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include pagination block in table.html regardless of table.paginator.num_pages? #621

Closed
apocalyptech opened this issue Sep 20, 2018 · 4 comments · Fixed by #622
Closed

Comments

@apocalyptech
Copy link
Contributor

Prior to 8f4146d, the pagination block in table.html was wrapped in this:

{% if table.page %}
{% block pagination %}
...
{% endblock pagination %}
{% endif %}

After that commit, the wrapping's changed to be a bit more specific:

{% if table.page and table.paginator.num_pages > 1 %}
    {% block pagination %}
    ...
    {% endblock pagination %}
{% endif %}

I've got an app which had been extending the tables.html template to provide custom pagination... In instances where there's only one page to display, in the new version the pagination block itself just doesn't exist to be overridden anymore. So my custom pagination override doesn't show up either.

Is it possible to flip the block and if statements so that the block exists regardless of the number of pages? Something basically like:

{% block pagination %}
    {% if table.page and table.paginator.num_pages > 1 %}
    ...
    {% endif %}
{% endblock pagination %}

That way it'd still be empty ordinarily, but someone extending the template would still be able to make use of it in all cases.

@apocalyptech
Copy link
Contributor Author

(Realized it was pretty lazy of me not to actually do a PR for this, so I've put one together, btw)

@jieter
Copy link
Owner

jieter commented Sep 21, 2018

Good point.

I'm willing to merge the PR, if the change is also applied to the other table templates, can you maybe add that to the PR?

@apocalyptech
Copy link
Contributor Author

Ohh, sure, I didn't even think to check the others, but you're right -- the same thing is in the rest, too. That's been added to the PR, though Travis CI is still doing its thing on it. (I've not really tested those manually, though I did run 'em through the unit tests again, at least.)

@jieter
Copy link
Owner

jieter commented Oct 22, 2018

released 2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants