Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 |
# -*- coding: utf-8 -*-
|
|
2 |
|
|
3 | 5 |
from django import template |
4 | 5 |
from django.template.defaultfilters import stringfilter |
5 |
|
|
6 | 5 |
from ..text import slugify as _slugify |
7 |
|
|
8 | 5 |
register = template.Library() |
9 |
|
|
10 |
|
|
11 | 5 |
@register.filter(is_safe=True) |
12 | 5 |
@stringfilter
|
13 | 4 |
def slugify(value): |
14 |
"""Template filter intended to override django 1.11+'s default slugify.
|
|
15 |
|
|
16 |
This can be installed via a builtin, or via
|
|
17 |
``{% load slugify_processor %}``.
|
|
18 |
|
|
19 |
Usage in a Django template:
|
|
20 |
|
|
21 |
.. code-block:: django
|
|
22 |
|
|
23 |
{% load slugify_processor %} {# unless you added it to builtins %}
|
|
24 |
{{variable|slugify}} {# assuming "variable" is in context %}
|
|
25 |
{{"C++"|slugify}}
|
|
26 |
"""
|
|
27 |
|
|
28 | 5 |
return _slugify(value) |
Read our documentation on viewing source code .