On Mar 15, 1:40 pm, jrs <j...@framemedia.com> wrote:
> I see nothing on this page that is in the slightest bit related to my
> question... Does anyone know if there is a way in the django orm to
> accomplish my query above?
>
> Thanks.

As I explained, there's nothing different in a self-join than with any
other sort of join. And so as of course you'll know, because you've
read the documentation, you can always access a related object via the
ForeignKey field:
  accountinstance = Account.objects.get(pk=whatever)
  accountinstance.parent_account

If (for performance reasons) you need to get both with a single query,
use select_related():
  accountinstance = Account.objects.select_related().get(pk=whatever)
--
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-us...@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