Skip to content

Commit b7aa7a7

Browse files
committed
Fix Jinja2 is required (#19)
Move common and Jinja2 files outside the templatetags/ directory because all files of this directory are automatically loaded by Django and that triggers an import of Jinja2. It requires to update the path to `jinja2_globals` in your project (README.md updated).
1 parent 1bf601f commit b7aa7a7

File tree

6 files changed

+4
-4
lines changed

6 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ The project provides examples of integration with Django and Jinja2 templates.
125125

126126
```python
127127
from jinja2.environment import Environment
128-
from webstack_django_sorting.templatetags.jinja2_globals import sorting_anchor, sort_queryset
128+
from webstack_django_sorting.jinja2_globals import sorting_anchor, sort_queryset
129129

130130
class JinjaEnvironment(Environment):
131131
def __init__(self, **kwargs):

testproj/testproj/testapp/jinja2/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from jinja2.environment import Environment
22

33
from django.template.defaultfilters import yesno
4-
from webstack_django_sorting.templatetags.jinja2_globals import (
4+
from webstack_django_sorting.jinja2_globals import (
55
sorting_anchor,
66
sort_queryset,
77
)
File renamed without changes.
File renamed without changes.
File renamed without changes.

webstack_django_sorting/templatetags/sorting_tags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from django.http import Http404
33
from django.utils.translation import gettext_lazy as _
44

5-
from .settings import INVALID_FIELD_RAISES_404
6-
from . import common
5+
from ..settings import INVALID_FIELD_RAISES_404
6+
from .. import common
77

88
register = template.Library()
99

0 commit comments

Comments
 (0)