{"action":"created","issue":{"url":"https://api.github.com/repos/iambrandontaylor/django-admin-sortable/issues/160","repository_url":"https://api.github.com/repos/iambrandontaylor/django-admin-sortable","labels_url":"https://api.github.com/repos/iambrandontaylor/django-admin-sortable/issues/160/labels{/name}","comments_url":"https://api.github.com/repos/iambrandontaylor/django-admin-sortable/issues/160/comments","events_url":"https://api.github.com/repos/iambrandontaylor/django-admin-sortable/issues/160/events","html_url":"https://github.com/iambrandontaylor/django-admin-sortable/issues/160","id":192476884,"number":160,"title":"Django error on drag and drop","user":{"login":"Fryyyyy","id":10647979,"avatar_url":"https://avatars.githubusercontent.com/u/10647979?v=3","gravatar_id":"","url":"https://api.github.com/users/Fryyyyy","html_url":"https://github.com/Fryyyyy","followers_url":"https://api.github.com/users/Fryyyyy/followers","following_url":"https://api.github.com/users/Fryyyyy/following{/other_user}","gists_url":"https://api.github.com/users/Fryyyyy/gists{/gist_id}","starred_url":"https://api.github.com/users/Fryyyyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fryyyyy/subscriptions","organizations_url":"https://api.github.com/users/Fryyyyy/orgs","repos_url":"https://api.github.com/users/Fryyyyy/repos","events_url":"https://api.github.com/users/Fryyyyy/events{/privacy}","received_events_url":"https://api.github.com/users/Fryyyyy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":27,"created_at":"2016-11-30T05:08:34Z","updated_at":"2016-12-02T02:48:20Z","closed_at":null,"body":"I receive an error when attempting to drag and drop rows in a SortableTabularInline:\r\n\r\n```Internal Server Error: /admin/app/event/sort/do-sorting/35/\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py\", line 39, in inner\r\n    response = get_response(request)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py\", line 249, in _legacy_get_response\r\n    response = self._get_response(request)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py\", line 187, in _get_response\r\n    response = self.process_exception_by_middleware(e, request)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py\", line 185, in _get_response\r\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 149, in _wrapped_view\r\n    response = view_func(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py\", line 57, in _wrapped_view_func\r\n    response = view_func(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py\", line 211, in inner\r\n    return view(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 67, in _wrapper\r\n    return bound_func(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/views/decorators/http.py\", line 40, in inner\r\n    return func(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 63, in bound_func\r\n    return func.__get__(self, type(self))(*args2, **kwargs2)\r\n  File \"/usr/local/lib/python2.7/dist-packages/adminsortable/admin.py\", line 301, in do_sorting_view\r\n    obj.save()\r\n  File \"/usr/local/lib/python2.7/dist-packages/adminsortable/models.py\", line 101, in save\r\n    super(SortableMixin, self).save(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 796, in save\r\n    force_update=force_update, update_fields=update_fields)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 824, in save_base\r\n    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 889, in _save_table\r\n    forced_update)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 939, in _do_update\r\n    return filtered._update(values) > 0\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/query.py\", line 654, in _update\r\n    return query.get_compiler(self.db).execute_sql(CURSOR)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py\", line 1148, in execute_sql\r\n    cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py\", line 824, in execute_sql\r\n    sql, params = self.as_sql()\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py\", line 1112, in as_sql\r\n    val = field.get_db_prep_save(val, connection=self.connection)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py\", line 755, in get_db_prep_save\r\n    prepared=False)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py\", line 747, in get_db_prep_value\r\n    value = self.get_prep_value(value)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py\", line 1832, in get_prep_value\r\n    return int(value)\r\nTypeError: int() argument must be a string or a number, not 'PositiveIntegerField'\r\n[30/Nov/2016 04:37:08] \"POST /admin/app/event/sort/do-sorting/35/ HTTP/1.1\" 500 17037\r\n```\r\n\r\nThe model contains `order_field = models.PositiveIntegerField(default=0, editable=False, db_index=True)` and we're using PostgreSQL.\r\n\r\nCheers!"},"comment":{"url":"https://api.github.com/repos/iambrandontaylor/django-admin-sortable/issues/comments/264359691","html_url":"https://github.com/iambrandontaylor/django-admin-sortable/issues/160#issuecomment-264359691","issue_url":"https://api.github.com/repos/iambrandontaylor/django-admin-sortable/issues/160","id":264359691,"user":{"login":"Fryyyyy","id":10647979,"avatar_url":"https://avatars.githubusercontent.com/u/10647979?v=3","gravatar_id":"","url":"https://api.github.com/users/Fryyyyy","html_url":"https://github.com/Fryyyyy","followers_url":"https://api.github.com/users/Fryyyyy/followers","following_url":"https://api.github.com/users/Fryyyyy/following{/other_user}","gists_url":"https://api.github.com/users/Fryyyyy/gists{/gist_id}","starred_url":"https://api.github.com/users/Fryyyyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fryyyyy/subscriptions","organizations_url":"https://api.github.com/users/Fryyyyy/orgs","repos_url":"https://api.github.com/users/Fryyyyy/repos","events_url":"https://api.github.com/users/Fryyyyy/events{/privacy}","received_events_url":"https://api.github.com/users/Fryyyyy/received_events","type":"User","site_admin":false},"created_at":"2016-12-02T02:48:20Z","updated_at":"2016-12-02T02:48:20Z","body":"Or maybe rename the internal variable, since I would imagine a field used for ordering would pretty commonly be called \"order_field\"?"}}
{"actor":{"display_login":"Fryyyyy"}}