Вопрос

I use this link for my template. My intention is to bring the user to the next page of a paginated.. well, page:

<a href="{% query_string 'page=page.next_page_number' 'page' %}">Next</a>

The problem is page.next_page_number is not evaluated as the next page number.

The template tag function query_string is supposed to remove then append the string argument to the url.

I saw this ticket to be exactly what my problem is:

Add querystring helper methods to Page class

I was aiming to make this the solution:

Manipulate URL query strings using context variables using a template tag

Can anyone help me please?

Это было полезно?

Решение

I am not 100% sure it will help, but in your example you pass a literal to template tag, to pass a variable, drop quotation marks:

<a href="{% query_string page=page.next_page_number page %}">Next</a>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top