I'm using the django_mongo_engine(0.4.0) as backed for django application.
an Instructor
object is created using like
inst = Instructor.objects.create(
email=request.POST.get('email').lower(),
password = set_password(request.POST.get('password')),
title=request.POST.get('title'),
first_name=request.POST.get('first_name'),
last_name=request.POST.get('last_name'))
and
request.session['inst_id'] = inst.id
in mongo shell this inst.id appears to be ObjectId(u'533c3b0c9b0dbb416e000000')
while in debug mode (pdb)
Instructor.objects.all()[0].id
will give id u'533c3b0c9b0dbb416e000000'
Error(s) when retrieving instructor object:
Instructor.objects.get(id=request.session['inst_id'])
ValueError: invalid literal for int() with base 10: '533c40a99b0dbb42d9000000'
instructor2 = Instructor.objects.get(id=ObjectId(request.session['inst_id']))
TypeError: int() argument must be a string or a number, not 'ObjectId'
instructor3 = Instructor.objects.get(id=str(request.session['inst_id']))
ValueError: invalid literal for int() with base 10: '533c40a99b0dbb42d9000000'
Any clue ?