Hi
I am wondering at some ways one can write a query in Django. Let's say for example :
Whatever.objects.filter(fk_object_id=fk_object_id)
Whatever.objects.filter(fk_object_id=fk_object.id)
Whatever.objects.filter(fk_object=fk_object)
and I could add to that list fk_object__id and fk_object__id__exact but my question is that while these syntaxes are equivalent in termes of results, one of them has got to be more efficient. I have read some posts about the subject, usually about optimizations, and could also guess that using an ID directly makes less behind-the-scene operations. On the other side, fk_object=fk_object surely looks more clean and concise to me.
I know I don't master the subtleties of all these syntaxes, but my question is why does Django not support only one (the most) efficient way of writing queries ?
Thanks for your thoughts about this.