2016-02-08 45 views
0

我想在这个问题上请求援助,我使用格拉佩利我联系,我想包括通过Django-admin-notifications管理通知模块,我遵循的基本用法,我每一步我得到一个错误,指出:Django的管理的通知错误

TemplateSyntaxError at /admin/ notification_tag' is not a valid tag library: Template library notification_tag not found

我得到的错误从{% load notification_tag %}

我严格遵循了指示(在已安装的应用中添加了admin_notifications,在url中添加了admin_notificationsadmin_notifications.autodiscover()),我做错了什么?

这里是什么样子

{% load notifications_tag %} 
{% extends "admin/base_site.html" %} 

<!-- LOADING --> 
{% load i18n grp_tags log %} 

<!-- JAVASCRIPTS --> 
{% block javascripts %} 
    {{ block.super }} 
{% endblock %} 

{% error_notifications %} 

<!-- COLTYPE/BODYCLASS-- > 
{% block bodyclass %}dashboard{% endblock %} 
{% block content-class %}content-grid{% endblock %} 

<!-- BREADCRUMBS --> 
.... 

notifications.py(index.html的格拉佩利的):

import admin_notifications 
from .models import boom 
def notification(): 
    items = boom.objects.all() 
    a = len(items) 
    if a: 
     return "You have " + str(a) + " items in models" 

admin_notifications.register(notification) 

的Python 2.7,Django的1.8.2

+0

你能告诉我你的'notification.py'文件是怎么样的吗? – doru

回答

1

在模板中你是试图加载notifications_tag

{% load notifications_tag %} 

或模板标签文件的名称是notification_tag。 所以,你应该写

{% load notification_tag %} 

whitout s

+0

我一直在叮叮咚响,解决这个问题,非常感谢! –