2016-02-08 41 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

我一直在叮叮咚響,解決這個問題,非常感謝! –