I have created a custom template tag that gets specific information
from the database:

linkroll.py:
from django.core import template
from seth_blog.blog.models import Linkroll
register = template.Library()

def linkroll():
    links = Linkroll.objects.all()[:5]
    return {'links': links}

# Here, register is a django.template.Library instance, as before
register.inclusion_tag('linkroll.html')(linkroll)

I assume that is right.  It is located under app/templatetags/.  The
templatetags folder also contains an __init__.py file.  I have the
linkroll.html file in my applications template directory.    I also put
{% load linkroll %} in my base.html template.  When I go to the site I
get this error:

TemplateSyntaxError at /
'linkroll' is not a valid tag library: Could not load template library
from django.templatetags.linkroll, cannot import name template
Request Method:         GET
Request URL:    http://localhost:8000/
Exception Type:         TemplateSyntaxError
Exception Value:        'linkroll' is not a valid tag library: Could not load
template library from django.templatetags.linkroll, cannot import name
template
Exception Location:
        /usr/lib/python2.4/site-packages/django/template/defaulttags.py in
load, line 692

What am I not doing right?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to