Django and MongoDB Engine - problem with object identifiers!

I am using Django 1.3beta strong> and django-mongodb-engine for the database.

The problem is that when I save an object with a set of pk, I get this error:

/usr/local/lib/python2.6/dist-packages/django/db/models/fields/__init__.pyc in get_prep_lookup(self, lookup_type, value) 290 return value 291 elif lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte'): --> 292 return self.get_prep_value(value) 293 elif lookup_type in ('range', 'in'): 294 return [self.get_prep_value(v) for v in value] /usr/local/lib/python2.6/dist-packages/django/db/models/fields/__init__.pyc in get_prep_value(self, value) 477 if value is None: 478 return None --> 479 return int(value) 480 481 def contribute_to_class(self, cls, name): ValueError: invalid literal for int() with base 10: '4cc75881006e4a1e0f000000' 

I guess this is because mongodb elements are stored with the key in hexadecimal, while django expects an int.

Any ideas what I can do about this?

+4
source share
1 answer

You will need a django-nerel form of django. If you follow the link that you posted, you will see it in the "Requirements" section

+3
source

All Articles