i'm having problems trying to add users to the admin on django for so long now that i haven't been able to learn much about django for months

292 views
Skip to first unread message

chucks ogwo

unread,
Mar 17, 2020, 11:39:24 PM3/17/20
to Django users
Environment:


Request Method: POST

Django Version: 2.0.7
Python Version: 3.8.2
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\backends\utils.py" in _execute
  85.                 return self.cursor.execute(sql, params)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\backends\sqlite3\base.py" in execute
  303.         return Database.Cursor.execute(self, query, params)

The above exception (no such table: main.auth_user__old) was the direct cause of the following exception:

File "C:\Users\Dell\leo\leo\lib\site-packages\django\core\handlers\exception.py" in inner
  35.             response = get_response(request)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\core\handlers\base.py" in _get_response
  128.                 response = self.process_exception_by_middleware(e, request)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\core\handlers\base.py" in _get_response
  126.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\options.py" in wrapper
  575.                 return self.admin_site.admin_view(view)(*args, **kwargs)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\utils\decorators.py" in _wrapped_view
  142.                     response = view_func(request, *args, **kwargs)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\sites.py" in inner
  223.             return view(request, *args, **kwargs)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\options.py" in change_view
  1557.         return self.changeform_view(request, object_id, form_url, extra_context)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\utils\decorators.py" in _wrapper
  62.             return bound_func(*args, **kwargs)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\utils\decorators.py" in _wrapped_view
  142.                     response = view_func(request, *args, **kwargs)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\utils\decorators.py" in bound_func
  58.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\options.py" in changeform_view
  1451.             return self._changeform_view(request, object_id, form_url, extra_context)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\options.py" in _changeform_view
  1498.                     self.log_change(request, new_object, change_message)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\options.py" in log_change
  784.         return LogEntry.objects.log_action(

File "C:\Users\Dell\leo\leo\lib\site-packages\django\contrib\admin\models.py" in log_action
  23.         return self.model.objects.create(

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\manager.py" in manager_method
  82.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\query.py" in create
  417.         obj.save(force_insert=True, using=self.db)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\base.py" in save
  728.         self.save_base(using=using, force_insert=force_insert,

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\base.py" in save_base
  759.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\base.py" in _save_table
  842.             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\base.py" in _do_insert
  879.         return manager._insert([self], fields=fields, return_id=update_pk,

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\manager.py" in manager_method
  82.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\query.py" in _insert
  1125.         return query.get_compiler(using=using).execute_sql(return_id)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\models\sql\compiler.py" in execute_sql
  1285.                 cursor.execute(sql, params)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\backends\utils.py" in execute
  100.             return super().execute(sql, params)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\backends\utils.py" in execute
  68.         return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\backends\utils.py" in _execute_with_wrappers
  77.         return executor(sql, params, many, context)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\backends\utils.py" in _execute
  85.                 return self.cursor.execute(sql, params)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\utils.py" in __exit__
  89.                 raise dj_exc_value.with_traceback(traceback) from exc_value

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\backends\utils.py" in _execute
  85.                 return self.cursor.execute(sql, params)

File "C:\Users\Dell\leo\leo\lib\site-packages\django\db\backends\sqlite3\base.py" in execute
  303.         return Database.Cursor.execute(self, query, params)

Exception Type: OperationalError at /admin/auth/user/1/change/
Exception Value: no such table: main.auth_user__old

Jorge Gimeno

unread,
Mar 17, 2020, 11:48:55 PM3/17/20
to django...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09aa453a-b3ad-447b-9364-06ba78dcd0ef%40googlegroups.com.

Django 2.0 is no longer maintained.  Unless there's a good reason, I'd suggest moving to Django 2.2 (2.2.11 is the latest stable version).

There was an issue where SQLite broke some migrations.  To fix this, I'd suggest:

pip install --upgrade django

In your virtual enviroment.  Then, run migrations again:

python manage.py makemigrations
python manage.py migrate

Let us know if that helps!

-Jorge

chucks ogwo

unread,
Mar 18, 2020, 8:31:35 AM3/18/20
to Django users
It worked!
I upgraded Django from 2.0.7 to 3.0.4 which is the latest version and now everything is working as it should.

Thank you very much, I'm super grateful
Reply all
Reply to author
Forward
0 new messages