Задать вопрос

Тел: +7 965 3737 888

476

Просмотров

2

Ответов

Load templatetag libraries via settings

In your settings file:

TEMPLATE_TAGS = ( "djutils.templatetags.sqldebug", )

Make sure load_templatetags() gets called somewhere, for example in your apps init.py

Edit: Updated to work with templatetag libraries that use certain critical django-bits.

Вопрос полезен? Да0/Нет0
file_4201.py(1.4Кб)
None

Ответы (2):

Ответsteve_cassidy51:11.12.2007
Ответ полезен? Да0/Нет0

This worked for me until I updated my django (svn) when I started getting a crash on startup due to unset ENV variables. I had the code in the main --init--.py (how do you do underscores?) in my project. Moving it to --init--.py in a subdirectory (application) removed the message and made everything happy again.

Ответrbell01824:05.04.2014
Ответ полезен? Да0/Нет0

There is a small bug in the import. It should read:

from django.template.loader import add_to_builtins

Note additionally that the template tag should be registered as:

<application>.templatetags.<template tag lib>