Open
Description
If I use exclude
I can lose my information. Here is what happens in my auth middleware:
17 if session_key:
18 try:
19 user = User.objects.exclude('crm_data').get(id=session_key)
20 import ipdb; ipdb.set_trace()
21 except User.DoesNotExist:
22 user = None
23 else:
---> 24 if not user.is_active:
25 ...
# crm_data was not loaded, but was replaced with default value
ipdb> user.crm_data
CrmData(notes=[], tags=[])
# but there are values in `crm_data` in the DB
ipdb> User.objects.get(id=session_key).crm_data
CrmData(notes=[], tags=[u'test'])
# if I accidentally save the instance
ipdb> user.save()
...
# data in the db is lost
ipdb> User.objects.get(id=session_key).crm_data
CrmData(notes=[], tags=[])