Closed SG5 closed 7 years ago
Can you provide a test case for that. I'm asking for that because this just works on my applications.
django
and django-jinja
with pipdjango-admin startproject mysite
.mysite
and create simple view and route for it
#views.py
from django.shortcuts import render
def test(request): return render(request, 'main/test.html')
```python
#urls.py
from django.conf.urls import url
from django.contrib import admin
from .views import test
urlpatterns = [
url(r'^$', test),
url(r'^admin/', admin.site.urls),
]
settings.py
replace TEMPLATES variable to config from first messagepython manage.py migrate
and run server python manage.py runserver
In your configuration, you are explicitly disables all extensions with extensions: []
, however, in your settings you have the i18n activated. In jinja i18n is managed by a extension and if you explicitly overwrites it with an empty list, you shouldn't expect that this will going to work as expected.
@niwinz I've run into this as well. I think the documentation is not really clear.
Auto-load templatetags compatible with Jinja2 the same way as Django.
I'm not sure what this means, load
tag doesn't work.
Django template filters and tags can mostly be used in Jinja2 templates.
Which ones? load
tag doesn't work. Okay, I deleted those. Then now
tag. So I started looking into the code. I saw that there are builtin filters, and extensions. Why enabling each and every filter if I can just enable a couple of extensions? So I added:
'extensions': [ 'django_jinja.builtins.extensions.DjangoFiltersExtension' ],
And got the error above. Now I see that django-jinja
by default enables a number of extensions. And yes, I've failed to notice the DEFAULT_EXTENSIONS +
part. But if the documenation were to mention which filters and tags are available by default, even if by pointing out at a file to look into, some of the users would probably save some time finding their way with the library.
And I'm still not sure if any Django tags work.
in file
"/usr/local/lib/python3.5/site-packages/django_jinja/backend.py"
, line 193 my settings: