Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integer out of range when pk is uuid #104

Open
yswtrue opened this issue Mar 28, 2021 · 3 comments · May be fixed by #97
Open

integer out of range when pk is uuid #104

yswtrue opened this issue Mar 28, 2021 · 3 comments · May be fixed by #97

Comments

@yswtrue
Copy link

yswtrue commented Mar 28, 2021

get error when pk is uuid.

ERROR 2021-03-28 17:29:30,102 log 1274593 140551966910016 Internal Server Error: /en-us/manager/trades/order/f1f522e9-4e00-4401-8700-0ce6ba6879db/change/
Traceback (most recent call last):
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/fsm_admin/mixins.py", line 164, in _do_transition
    trans_func(request=request, by=request.user)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django_fsm/__init__.py", line 520, in _change_state
    return fsm_meta.field.change_state(instance, func, *args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django_fsm/__init__.py", line 326, in change_state
    result = method(instance, *args, **kwargs)
TypeError: obsolete() got an unexpected keyword argument 'request'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/fsm_admin/mixins.py", line 168, in _do_transition
    trans_func(by=request.user)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django_fsm/__init__.py", line 520, in _change_state
    return fsm_meta.field.change_state(instance, func, *args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django_fsm/__init__.py", line 326, in change_state
    result = method(instance, *args, **kwargs)
TypeError: obsolete() got an unexpected keyword argument 'by'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.NumericValueOutOfRange: integer out of range
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/contrib/admin/options.py", line 614, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/contrib/admin/sites.py", line 233, in inner
    return view(request, *args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1656, in change_view
    return self.changeform_view(request, object_id, form_url, extra_context)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1534, in changeform_view
    return self._changeform_view(request, object_id, form_url, extra_context)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1580, in _changeform_view
    self.save_model(request, new_object, form, not add)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/fsm_admin/mixins.py", line 188, in save_model
    self._do_transition(transition, request, obj, form, fsm_field)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/fsm_admin/mixins.py", line 171, in _do_transition
    trans_func()
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django_fsm/__init__.py", line 520, in _change_state
    return fsm_meta.field.change_state(instance, func, *args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django_fsm/__init__.py", line 345, in change_state
    post_transition.send(**signal_kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 177, in send
    return [
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 178, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django_fsm_log/backends.py", line 82, in post_transition_callback
    return _pre_transition_callback(sender, instance, name, source, target, StateLog.objects, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django_fsm_log/backends.py", line 28, in _pre_transition_callback
    manager.create(**values)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/models/query.py", line 447, in create
    obj.save(force_insert=True, using=self.db)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/models/base.py", line 753, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/models/base.py", line 790, in save_base
    updated = self._save_table(
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/models/base.py", line 895, in _save_table
    results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/models/base.py", line 933, in _do_insert
    return manager._insert(
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/models/query.py", line 1254, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1397, in execute_sql
    cursor.execute(sql, params)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/debug_toolbar/panels/sql/tracking.py", line 198, in execute
    return self._record(self.cursor.execute, sql, params)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/debug_toolbar/panels/sql/tracking.py", line 133, in _record
    return method(sql, params)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/yswtrue/Code/seatower_erp/.venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.DataError: integer out of range

@MRigal
Copy link
Member

MRigal commented Jan 14, 2022

Hi @yswtrue
Indeed the code is pretty deeply tied to pk being an integer. It won't be a small change, but if you need support for it, feel free to submit a PR :-)

@MRigal MRigal changed the title integer out of range integer out of range when pk is uuid Jan 14, 2022
@achillis2
Copy link

Is this issue fixed? I ran to this issue again today.

@DrMartiner
Copy link

Is this issue fixed? I ran to this issue again today.

I faced this issue. It's still not fixed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants