#30008: OperationalError Thrown On Admin Page While Modifying Data
-----------------------------------------+------------------------
               Reporter:  Hansheng Zhao  |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  Uncategorized  |        Version:  2.1
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 **Environment**
 System: Mac OS Version 10.13.6
 Python: Python 3.7.1 [via Homebrew]
 Django: Django 2.1.3/2.1.4

 **Description**
 Following through Django tutorial, after ''migrate'' and
 ''createsuperuser'' etc, tried to modify the saved first name and last
 name for the super user on the admin page, got an '''OperationalError'''
 suggesting that '''no such table: main.auth_user__old'''.

 **Details**
 This exception is encountered for both Django 2.1.3 and 2.1.4 with Python
 3.7.1 under macOS High Sierra, and have effects even when the user is
 trying to modify other models (like the ''polls.models.Question' model').

 However, when using Django 2.1.4 under PyPy3.5 version 6.0.0 or using
 Django 1.11.14 under Python2 and PyPy, no exceptions were encountered when
 performing the same actions.

 SQLite ''.table'' command showed that under all the aforementioned
 installations, the database consists of the same table sets ''auth_group
 auth_user_user_permissions auth_group_permissions django_admin_log
 auth_permission django_content_type auth_user django_migrations
 auth_user_groups django_session''.

 **Stack Trace**
 {{{
 #!python
 Internal Server Error: /admin/auth/user/1/change/
 Traceback (most recent call last):
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/backends/utils.py", line 85, in _execute
     return self.cursor.execute(sql, params)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/backends/sqlite3/base.py", line 296, in execute
     return Database.Cursor.execute(self, query, params)
 sqlite3.OperationalError: no such table: main.auth_user__old

 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/core/handlers/exception.py", line 34, in inner
     response = get_response(request)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/core/handlers/base.py", line 126, in _get_response
     response = self.process_exception_by_middleware(e, request)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/core/handlers/base.py", line 124, in _get_response
     response = wrapped_callback(request, *callback_args,
 **callback_kwargs)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/contrib/admin/options.py", line 604, in wrapper
     return self.admin_site.admin_view(view)(*args, **kwargs)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/utils/decorators.py", line 142, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
     response = view_func(request, *args, **kwargs)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/contrib/admin/sites.py", line 223, in inner
     return view(request, *args, **kwargs)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/contrib/admin/options.py", line 1640, in change_view
     return self.changeform_view(request, object_id, form_url,
 extra_context)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/utils/decorators.py", line 45, in _wrapper
     return bound_method(*args, **kwargs)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/utils/decorators.py", line 142, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/contrib/admin/options.py", line 1525, in changeform_view
     return self._changeform_view(request, object_id, form_url,
 extra_context)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/contrib/admin/options.py", line 1571, in _changeform_view
     self.log_change(request, new_object, change_message)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/contrib/admin/options.py", line 826, in log_change
     change_message=message,
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/contrib/admin/models.py", line 35, in log_action
     change_message=change_message,
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/models/manager.py", line 82, in manager_method
     return getattr(self.get_queryset(), name)(*args, **kwargs)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/models/query.py", line 413, in create
     obj.save(force_insert=True, using=self.db)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/models/base.py", line 718, in save
     force_update=force_update, update_fields=update_fields)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/models/base.py", line 748, in save_base
     updated = self._save_table(raw, cls, force_insert, force_update,
 using, update_fields)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/models/base.py", line 831, in _save_table
     result = self._do_insert(cls._base_manager, using, fields, update_pk,
 raw)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/models/base.py", line 869, in _do_insert
     using=using, raw=raw)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/models/manager.py", line 82, in manager_method
     return getattr(self.get_queryset(), name)(*args, **kwargs)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/models/query.py", line 1136, in _insert
     return query.get_compiler(using=using).execute_sql(return_id)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/models/sql/compiler.py", line 1289, in execute_sql
     cursor.execute(sql, params)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/backends/utils.py", line 100, in execute
     return super().execute(sql, params)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/backends/utils.py", line 68, in execute
     return self._execute_with_wrappers(sql, params, many=False,
 executor=self._execute)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
     return executor(sql, params, many, context)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/backends/utils.py", line 85, in _execute
     return self.cursor.execute(sql, params)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/utils.py", line 89, in __exit__
     raise dj_exc_value.with_traceback(traceback) from exc_value
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/backends/utils.py", line 85, in _execute
     return self.cursor.execute(sql, params)
   File "/Users/hzhao/Workstation/env/lib/python3.7/site-
 packages/django/db/backends/sqlite3/base.py", line 296, in execute
     return Database.Cursor.execute(self, query, params)
 django.db.utils.OperationalError: no such table: main.auth_user__old
 [04/Dec/2018 19:39:24] "POST /admin/auth/user/1/change/ HTTP/1.1" 500
 208079
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30008>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.9609c06bcf9ac232a5d84248da8a55ec%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to