be smarter about figuring out when querying for pk (and useful with django 1.6)