Django queries – id vs pk

It doesn’t matter. pk is more independent from the actual primary key field i.e. you don’t need to care whether the primary key field is called id or object_id or whatever.

It also provides more consistency if you have models with different primary key fields.

Leave a Comment