views:

24

answers:

1

Hi folks,

I'm using Django 1.3beta and django-mongodb-engine for database backend.

Problem is when I save an object with a pk set 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 it is because mongodb items are stored with a key in hexadecimal, while django expects an int.

Any ideas what I can do about this?

+1  A: 

You'll need django-nonrel fork of django. If you'll follow the link you've posted, you'll see it's specified in "Requirements"

cheshire
This was exactly it thanks :)
RadiantHex