mirror of
https://github.com/ae-utbm/sith.git
synced 2026-03-28 22:39:43 +00:00
Use urlencode for querystring macro
This commit is contained in:
@@ -124,8 +124,11 @@
|
|||||||
This must be coupled with a view that handles pagination
|
This must be coupled with a view that handles pagination
|
||||||
with the Django Paginator object.
|
with the Django Paginator object.
|
||||||
|
|
||||||
Warning:
|
Warnings:
|
||||||
You must include this macro `with context` as it uses the `querystring` macro
|
This macro must be imported with context :
|
||||||
|
```jinja
|
||||||
|
{% from "core/macros.jinja" import paginate_jinja with context %}
|
||||||
|
```
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
current_page (django.core.paginator.Page): the current page object
|
current_page (django.core.paginator.Page): the current page object
|
||||||
@@ -142,8 +145,11 @@
|
|||||||
|
|
||||||
The replaced fragment will be #content so make sure you are calling this macro inside your content block.
|
The replaced fragment will be #content so make sure you are calling this macro inside your content block.
|
||||||
|
|
||||||
Warning:
|
Warnings:
|
||||||
You must include this macro `with context` as it uses the `querystring` macro
|
This macro must be imported with context :
|
||||||
|
```jinja
|
||||||
|
{% from "core/macros.jinja" import paginate_jinja with context %}
|
||||||
|
```
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
current_page (django.core.paginator.Page): the current page object
|
current_page (django.core.paginator.Page): the current page object
|
||||||
@@ -254,14 +260,7 @@
|
|||||||
|
|
||||||
|
|
||||||
{% macro querystring() %}
|
{% macro querystring() %}
|
||||||
{%- for key, values in request.GET.lists() -%}
|
{%- set qs = request.GET.copy() -%}
|
||||||
{%- if key not in kwargs -%}
|
{%- do qs.update(kwargs) -%}
|
||||||
{%- for value in values -%}
|
{{- qs | urlencode -}}
|
||||||
{{ key }}={{ value }}&
|
|
||||||
{%- endfor -%}
|
|
||||||
{%- endif -%}
|
|
||||||
{%- endfor -%}
|
|
||||||
{%- for key, value in kwargs.items() -%}
|
|
||||||
{{ key }}={{ value }}&
|
|
||||||
{%- endfor -%}
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
Reference in New Issue
Block a user