Juan Carlos Asuncion February 2016

Django-admin-notifications error

I would like to request assistance in this matter, I am using grappelli for my admin and I am trying to include an admin notification module via Django-admin-notifications, I have followed every steps in the basic usage and I am getting an error that says:

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

I am getting errors from {% load notification_tag %}.

I have followed the directions strictly(added admin_notifications in installed apps, imported admin_notifications in urls with admin_notifications.autodiscover()), What am i doing wrong?

Here's what it looks like(index.html of grappelli)

{% 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:

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

Answers


doru February 2016

In your template you are trying to load notifications_tag:

{% load notifications_tag %}

or the name of the template tag file is notification_tag. So, you should write

{% load notification_tag %}

whitout s.

Post Status

Asked in February 2016
Viewed 3,436 times
Voted 11
Answered 1 times

Search




Leave an answer