Closed bhcarpenter closed 11 years ago
I'm a little concerned because of some edge cases like querying- eg User.objects.get(id=5)
. The resulting object will have act like this
>>> user = User.objects.get(id=5)
>>> user.id
5
>>> user.user_id
# some other id
>>> user.id == user.user_id
False
OTOH,
>>> user = login(...)
>>> user.id
# some other id
>>> user.id == user.user_id
True
Obviously this particular example is easy to test so I'll get on that.
I'm going to leave this open and see if I can get primary_key=True
working properly (and really just explore further)- if there's still a problem we might have to do this or something similar.
Yep that's exactly right (and even intended).
Unfortunately, django.contrib.auth persists the id
field of the user given to login
, so if we want to have get_user
retrieve by user_id
instead later, we'll have to fake it somehow.
I agree that this is probably going to cause issues (and I already know that it breaks django_social_auth). Let's keep talking offline.
Add an adapter so Django stores the right value into session. We want to store and use the
user_id
property instead of theid
.Retrieving the
User
viauser_id
was already taken care of. This takes care of storing theuser_id
.Refs #152