Despite several hours of poking around, I'm just not getting how to
make custom template tags and would greatly appreciate a little hand
holding.
I've created a directory called "templatetags" that's in the same
directory as models.py and views.py. In the templatetags directory,
there's an __init__.py file and a file called custom_tags.py, which
contains:
from django.conf import settings
from django.template import Library
def media():
return settings.MEDIA_URL
register = Library()
register.simple_tag("media")
In my base.html template the very first line is:
{% load custom_tags %}
In settings.py I have:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'myapp.main',
'myapp.main.templatetags',
'django.contrib.admin',
)
This results in an exception:
Exception Type: TypeError
Exception Value: arg is not a Python function
Exception Location: D:\Python24\Lib\inspect.py in getargspec, line
677
Any idea 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
-~----------~----~----~----~------~----~------~--~---