DataError: integer out of range
dbinetti opened this issue · comments
Getting an integer out of range error -- any ideas how to debug? I'm using the FSMIntegerField for my states and django-model-utils backed by a Choices field. I was able to run tests with FSMIntegerField and Choices with no problems, so not sure what's happening...
---------------------------------------------------------------------------
DataError Traceback (most recent call last)
<ipython-input-4-7a7130d4660d> in <module>()
----> 1 c.start()
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django_fsm_log/decorators.pyc in wrapped(*args, **kwargs)
10 instance.by = kwargs['by']
11
---> 12 out = func(instance, *arg_list, **kwargs)
13
14 if kwargs.get('by', False):
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django_fsm/__init__.pyc in _change_state(instance, *args, **kwargs)
510 @wraps(func)
511 def _change_state(instance, *args, **kwargs):
--> 512 return fsm_meta.field.change_state(instance, func, *args, **kwargs)
513
514 if not wrapper_installed:
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django_fsm/__init__.pyc in change_state(self, instance, method, *args, **kwargs)
335 raise
336 else:
--> 337 post_transition.send(**signal_kwargs)
338
339 return result
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/dispatch/dispatcher.pyc in send(self, sender, **named)
190
191 for receiver in self._live_receivers(sender):
--> 192 response = receiver(signal=self, sender=sender, **named)
193 responses.append((receiver, response))
194 return responses
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django_fsm_log/backends.pyc in post_transition_callback(sender, instance, name, source, target, **kwargs)
57 state=target,
58 transition=name,
---> 59 content_object=instance,
60 )
61
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/models/manager.pyc in manager_method(self, *args, **kwargs)
120 def create_method(name, method):
121 def manager_method(self, *args, **kwargs):
--> 122 return getattr(self.get_queryset(), name)(*args, **kwargs)
123 manager_method.__name__ = method.__name__
124 manager_method.__doc__ = method.__doc__
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/models/query.pyc in create(self, **kwargs)
399 obj = self.model(**kwargs)
400 self._for_write = True
--> 401 obj.save(force_insert=True, using=self.db)
402 return obj
403
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/models/base.pyc in save(self, force_insert, force_update, using, update_fields)
706
707 self.save_base(using=using, force_insert=force_insert,
--> 708 force_update=force_update, update_fields=update_fields)
709 save.alters_data = True
710
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/models/base.pyc in save_base(self, raw, force_insert, force_update, using, update_fields)
734 if not raw:
735 self._save_parents(cls, using, update_fields)
--> 736 updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
737 # Store the database on which the object was saved
738 self._state.db = using
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/models/base.pyc in _save_table(self, raw, cls, force_insert, force_update, using, update_fields)
818
819 update_pk = bool(meta.has_auto_field and not pk_set)
--> 820 result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
821 if update_pk:
822 setattr(self, meta.pk.attname, result)
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/models/base.pyc in _do_insert(self, manager, using, fields, update_pk, raw)
857 """
858 return manager._insert([self], fields=fields, return_id=update_pk,
--> 859 using=using, raw=raw)
860
861 def delete(self, using=None, keep_parents=False):
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/models/manager.pyc in manager_method(self, *args, **kwargs)
120 def create_method(name, method):
121 def manager_method(self, *args, **kwargs):
--> 122 return getattr(self.get_queryset(), name)(*args, **kwargs)
123 manager_method.__name__ = method.__name__
124 manager_method.__doc__ = method.__doc__
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/models/query.pyc in _insert(self, objs, fields, return_id, raw, using)
1037 query = sql.InsertQuery(self.model)
1038 query.insert_values(fields, objs, raw=raw)
-> 1039 return query.get_compiler(using=using).execute_sql(return_id)
1040 _insert.alters_data = True
1041 _insert.queryset_only = False
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/models/sql/compiler.pyc in execute_sql(self, return_id)
1058 with self.connection.cursor() as cursor:
1059 for sql, params in self.as_sql():
-> 1060 cursor.execute(sql, params)
1061 if not (return_id and cursor):
1062 return
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/backends/utils.pyc in execute(self, sql, params)
77 start = time()
78 try:
---> 79 return super(CursorDebugWrapper, self).execute(sql, params)
80 finally:
81 stop = time()
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/backends/utils.pyc in execute(self, sql, params)
62 return self.cursor.execute(sql)
63 else:
---> 64 return self.cursor.execute(sql, params)
65
66 def executemany(self, sql, param_list):
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/utils.pyc in __exit__(self, exc_type, exc_value, traceback)
93 if dj_exc_type not in (DataError, IntegrityError):
94 self.wrapper.errors_occurred = True
---> 95 six.reraise(dj_exc_type, dj_exc_value, traceback)
96
97 def __call__(self, func):
/Users/dbinetti/.virtualenvs/barberscore/lib/python2.7/site-packages/django/db/backends/utils.pyc in execute(self, sql, params)
62 return self.cursor.execute(sql)
63 else:
---> 64 return self.cursor.execute(sql, params)
65
66 def executemany(self, sql, param_list):
DataError: integer out of range
In [5]:
any ideas?
This is given that object_id
uses PositiveInteger
, and your code is trying to store an id which is not an integer. See: #34,#35 for details. One solution to use CharField
is to e.g: https://github.com/marsam/django-fsm-log/commit/9f573e3
Duplicate of #34 ? it not please re-open