tags:

views:

425

answers:

3

i get an "Out of range value adjusted for column"

not sure whether there is a fix for this in django

+1  A: 

Django ticket #399 deals with this. I also opened a similar question quite some time ago.

A workaround that I have used in the past is to simply ALTER the field in question directly in the DB table to BIGINT (for MySQL, for example). Note, however, that if you reset the application in which the particular model with the particular field exists, or drop the table and recreate it by any means, you will have to ALTER the field again.

ayaz
hey, this is what i did and it worked, but somehow i feel this isn't the right solution.
Rasiel
+3  A: 

You should create custom field inhrited from Field or IntegerField

class BigintField(models.Field):
    def db_type(self):
        return 'BIGINT(20)'
...

and

class MyModel(models.Model):
    bigid = BigintField()
N. Aff
A: 

For South users, django's built-in DecimalField may work better than the custom BigintField approach above. Looks like it takes a bit of extra work to teach South about custom field types.

softmechanics