开发者

How come I'm getting this Django error?

I installed an app called Django-notification, which uses Django-pagination. However, it can't find the Django_pagination template tags!

Exception Type: TemplateSyntaxError at /notifications
Exception Value: 'pagination_tags' is not a valid tag library: Template library pagination_tags not found, tried django.templatetags.pagination_tags,django.contrib.admin开发者_StackOverflow.templatetags.pagination_tags,django.contrib.humanize.templatetags.pagination_tags,pinax.templatetags.templatetags.pagination_tags

Why? I installed Django-pagination already. It's in my site-packages: django_pagination-1.0.7-py2.6.egg

Next, I put "pagination" in my INSTALLED_APPS.

I even imorted pagination in my views.py. Although I doubt that'll make a difference.


Just to make sure, have you called {% load pagination_tags %} in your template?

From django's documentation:

The app that contains the custom tags must be in INSTALLED_APPS in order for the {% load %} tag to work. This is a security feature: It allows you to host Python code for many template libraries on a single host machine without enabling access to all of them for every Django installation.

There's no limit on how many modules you put in the templatetags package. Just keep in mind that a {% load %} statement will load tags/filters for the given Python module name, not the name of the app.

To be a valid tag library, the module must contain a module-level variable named register that is a template.Library instance...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜