Tried that. Still no good. I renamed the file as bookmark_tags.py and
deleted every .pyc file in the app. Nothing in my templatetags
directory actually compiled--neither __init__.py nor bookmarks.py
(even after being renamed).

Like I said before, when I take out the import line (from
bookmarks.models import Bookmark) the library loads (even when called
bookmarks.py) and only hits an error when it tries to access
Bookmark.objects.all().



On Oct 15, 6:22 pm, felix <[EMAIL PROTECTED]> wrote:
> this gets me every time.
>
> the error is yes because the template tag is called bookmarks.py
> and its inside a module called bookmarks.py
>
> rename it to bookmarks_tags.py ...
>
> and now ....
>
> DELETE THE DAMNED OLD bookmarks.pyc file !
>
> python is still finding the old compiled file.
>
> its happened to me twice already in the exact same fashion.
>
> -f;lix
>
> On Oct 15, 7:17 pm, Chris Amico <[EMAIL PROTECTED]> wrote:
>
> > The templatetag file is indeed called bookmarks.py. I thought of that,
> > tried renaming it as bookmark_tags.py, and got the same error. I'll
> > add that the bookmarks app lives on my python path, not in any
> > particular project, since I'm trying to make this as reusable as
> > possible.
>
> > At one point, I tried just removing the line 'from bookmarks.models
> > import Bookmark', and the library loaded, but it hit an error
> > (correctly) when I tried use it, saying Bookmark wasn't defined.
>
> > On Oct 14, 11:45 pm, Daniel Roseman <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Oct 15, 7:38 am, Chris Amico <[EMAIL PROTECTED]> wrote:
>
> > > > I have a simple bookmarks model based on the one in James Bennett's <a
> > > > href="http://code.google.com/p/cab/source/browse/trunk/models.py?
> > > > r=130">Cab</a> application. I'm using a generic relation so it can
> > > > live in its own app and a user can bookmark any object on the site
> > > > (I'm planning on reusing this app on a couple projects). I'm running
> > > > into a problem creating an {% if_bookmarked %}templatetag.
>
> > > > When I load the tag library I get this error: 'bookmarks' is not a
> > > > valid tag library: Could not loadtemplatelibrary from
> > > > django.templatetags.bookmarks,Nomodulenamedmodels
>
> > > > Here's what the tagmodulelooks like:
>
> > > <snip>
>
> > > > The bookmarking model works fine on its own, and I've gotten the
> > > > functions in thetemplatetag to work in isolation in the interpreter,
> > > > but when I load the tag library it breaks thetemplate. What am I
> > > > missing here?
>
> > > Is the templatetag file itself called bookmarks.py, by any chance? If
> > > so, the code may be trying to import that rather than the top-level
> > > bookmarks directory. Try renaming the file, although I would also
> > > recommend using full paths when importing (ie from
> > > projectname.bookmarks.models).
> > > --
> > > DR
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to