Hi all,
I am new to Django and am trying to get my site, which is now built
with ExpressionEngine, running on my development machine.
I am trying to write a custom filter. When I place it in a template,
I get the following error message:
'blog_extras' is not a valid tag library: Could not load template
library from django.templatetags.blog_extras, cannot import name
Category
I have one app, weblog, in my project, which in turn has two models in
models.py: Category and Entry. There is a templatetags directory
there as well containing __init__.py and blog_extras.py. weblog is
installed in INSTALLED_APPS and aside from the filter problem works as
intended. The contents of blog_extras.py is as follows:
from django import template
from weblog.models import Entry
register = template.Library()
@register.filter()
def category_url(entry_id):
e = Entry.objects.get(id=entry_id)
return e.category.url
I have tried 'breaking' the filter module by entering all manner of
syntax errors in the file, deleting the import statements, leaving it
blank, etc. No matter what I do the error message is the same. I am
a sloppy, amateur programmer and I am sure there is something idiotic
here that I am missing, perhaps something in the settings? Or
PYTHONPATH?
Any help is much appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---