On Sun, 2009-04-26 at 06:09 -0700, tekion wrote:
> Hi,
> I have tried to load my customer filter, but getting an error which
> indicates it's not in the path. I saw a similar post, one of the
> suggested things to check was to make sure the project was listed in
> the setting.py file. My project is listed in the setting.py file
> under the install_app. Any idea why? Thanks in advance.
Just so that you use the normal terminology in the future: when you
wrote "project" above, we call them "applications" in Django. A Django
"project" is a collection of applications, a settings file and a root
URL configuration file. The things in the INSTALLED_APPS list are
applications.
Onto your actual problem: The other two reasonably common mistakes,
besides not having the tag inside an application, are
(1) Not putting it inside a templatetags/ directory inside the
application directory (or misspelling "templatetags", which is
surprisingly easy to typo).
(2) Not having an __init__.py file inside the templatetags directory.
As a simple check for syntax errors and the like, if you've done both of
those things and your directory structure looks something like this:
my_app/
__init__.py
templatetags/
__init__.py
my_filters.py
...
... try starting up the "manage.py shell" interactive shell and
importing the filter manually. That is:
>>> from my_app.templatetags import my_filters
If that doesn't raise an exception, you've at least avoided making any
egregious errors in the basic setup.
If you've done all that and it still fails to work, please construct a
small example so that you can show us a few more details. It would be
interesting to see a small template that attempts to use the filter, the
directory structure layout you have and the filter file (if the latter
is 1000's of lines long, trim it down to a simple filter that just
returns the string "hello" to make things shorter).
Regards,
Malcolm
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---