Hey all, if I have a foreign key on a model (say Model B has a foreign
key to Model A) and I do something like this:

a = A.objects.get( pk = 1 )
b = B.objects.get( pk = 1 )

if b.a == a :
    # Do something

Is that inefficient, since its doing a join to pull b.a? Should I be
comparing their ids? How do I get that from the b model? Something
like this:

if b.a_id == a.id :
   # Do something

Not sure about the syntax. Thanks!
-- 
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