Tuesday, November 1, 2011

Field available via Django shell but not via web application (crossposted from StackOverFlow)

On the web page, I get the following error:

FieldError at /foo/bar/
Cannot resolve keyword 'foos' into field. Choices are: __unused__,
[snip]

The problem code is

User.objects.filter(foos__name='bar')

When I run this in the shell, it works and I get a recordset:

>>> User.objects.filter(foos__name='bar')
[<User: JordanReiter>]

But on the webpage I get the exception above.

Already checked:
- INSTALLED_APPS are identical for both settings
- runserver version also works (as would be expected)
- User used is identical in both cases and is
`django.contrib.auth.models.User`
- related names for the shell's User and the web app's User are
*definitely* different. User._meta.get_all_related_objects() in the
shell displays around 7 more related fields than the if I dump that
from the web app.

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

No comments:

Post a Comment