Google apparently won't let me reply to an older thread:
http://groups.google.com/group/django-users/browse_thread/thread/94239f017df4b12f
so starting a new one.

I too was hitting the "No module named models" problem when creating a
template tag. I had the tag working perfectly when it communicated
exclusively with the models belong to the app the templatetag lived
in. But I needed to modify the tag to also get data from models in
another of the project's apps. That other app imports fine from
wherever I use it, but I could not get its models to be imported into
the template tag. No amount of path tweaking, debugging, deleting .pyc
files etc. would help.

The docs say: "Custom template tags and filters must live inside a
Django app. If they relate to an existing app it makes sense to bundle
them there; otherwise, you should create a new app to hold them."

They do not say whether a template tag should be able to talk to
models from two different apps, but I assume they would be able to. My
final solution was to merge the two apps into one. Not ideal, but not
horrible in this particular circumstance. I did not try creating a new
app just to hold the templatetag.

Anyway, the question is, shouldn't template tags that live inside one
app's directory also be able to get data from other apps?

Thanks,
Scot
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to