On Apr 24, 1:45 am, "Jason McVetta" <[EMAIL PROTECTED]> wrote: > > TypeError: Cannot resolve keyword 'book' into field > > This is a long-standing, well-known bug that apparently no one (including > me) knows how to fix. > > Any time one defines a ManyToMany relationship, then calls all() on that > relationship from a script, a "cannot resolve keyword into field" error > results. The problem involves some deep voodoo about how and when modules > are imported, which is why it occurs only in scripts but not in the admin > interface or the manage.py shell. If you google around the django-users > archives and bug tickets, you'll see some (imho truly hideous) hacks for > working around it by mangling your import statements.
Jason, I have observed that if I add the directory containing my django project to PYTHONPATH, this problem doesn't come (something similar was mentioned in one of the tickets). For example if my project resides in /home/ram/mysite-, adding this line at the top of my script make it work- sys.path.append('/home/ram') May be, that can provide some hint. -Ram --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---