I've just created a template tag as described in the documents, but
keep getting errors.
In an installed app I created a directory called Templatetags. I
created a blank __init__.py file and a file called mytag. Mytag has a
function
from django import template
register template.Library()
def uscurrency(c):
try:
if c > 0:
return '$%.2f'% c
else:
return '-$%.2f' % (-1*c)
except TypeError:
return c
register.filter(uscurrency)
In my template I have {% load mytag %}
Yet I get this error:
'mytag' is not a valid tag library: Could not load template library
from django.templatetags.mytag, No module named mytag
Suggestions as to what I'm doing wrong?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---