Thank you; the first seemed to work nicely. On Wed, Jul 14, 2010 at 2:36 PM, ringemup <[email protected]> wrote:
> Try: > > directory.models.Entity.objects.get(pk=id) > > Which does pretty much the same thing as: > > directory.models.Entity.objects.filter(id__exact = id)[0] > > (note id__exact rather than id__equals) > > > > On Jul 14, 3:18 pm, Jonathan Hayward > <[email protected]> wrote: > > How do I look up a model instance by id (its primary key)? I have: > > > > entity = directory.models.Entity.objects.filter(id__equals = id)[0] > > > > and am getting: > > > > FieldError at /profile/1 > > > > Join on field 'id' not permitted. Did you misspell 'equals' for the > lookup type? > > > > Is there another way I should be going about this given the id field > > beforehand? > > > > -- > > → Jonathan Hayward, [email protected] > > → An Orthodox Christian author: theology, literature, et cetera. > > → My award-winning collection is available for free reading online: > > ☩ I invite you to visit my main site athttp://JonathansCorner.com/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<django-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- → Jonathan Hayward, [email protected] → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. 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.

