On Thu, Jun 23, 2011 at 10:16 PM, EAMiller <thn...@gmail.com> wrote:

> I'm getting a 'cannot resolve keyword' on a objects.filter that
> doesn't seem to make sense.
>
> Here is the model:
>
> class Person(models.Model):
>    payee = models.ForeignKey(
>        Payee,
>        null=True,
>        blank=True,
>    )
>    ut = models.ForeignKey(
>        Utility,
>        null=True,
>        blank=True,
>    )
>
> The problem:
>
> Utility.objects.filter(person=1144) # works fine
> Payee.objects.filter(person=26) # gives us FieldError: Cannot resolve
> keyword 'person' into field
>

Is this what you need??

Payee.objects.filter(
    person = Person(id=26)
)

or.. Payee.objects.filter(
    person__id = 26
) - but this would be slightly more performance hitting i think.



>
> I've tried to follow this around, finding myself in the Options object
> where I printed out self._related_objects_cache.items() ... Utility
> has about 20 other models that define a FK to it, and appear in the
> related objects cache. Payee has about 13 models that define a FK to
> it - but only one of them appears in the related object cache (and
> it's not 'person')
>
> I haven't been able to track it beyond this point to anything
> conclusive. Any suggestions on where to look next?
>
> using: django 1.3 (had same issue in 1.1 before migrating), postgres
> 8.4 / psycopg2
>
> --
> 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.
>
>

-- 
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