no such table error while adding records

When i try to add record in table in the django admin page , i get Exception:-

No operational error and the Exception Value:no such table:main.auth_user_old

I am using sqlllite database ,please help me in resolving this error

Have you done your makemigrations and migrate?

If you have, and it’s still not working, we’ll need to see the models and the ModelAdmin classes involved.

I have did makemigrations and migrate but still not working,

Models.py:-

from django.db import models

Create your models here.

class Employee(models.Model):
eno=models.IntegerField();
ename=models.CharField(max_length=30);
esal=models.FloatField();
addr=models.CharField(max_length=30);

admin.py:-

from django.contrib import admin
from testApp.models import Employee

Register your models here.

admin.site.register(Employee);

First, when posting code, templates, html, error messages, etc, here, please enclose it between lines consisting of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This maintains proper formatting.

There’s clearly some context missing here - whether it’s a change in another part of your application, or a third party app you have installed, or something beyond the information you’ve posted so far.

It may be helpful if you posted the complete traceback.

First thing I’d suggest to try would be to change your settings file to reference a new / different database and start from scratch.

This is the error i am getting ,attached in the photo, my django version is 2.0 , regarding models.py and admin.py , I have pasted above, I have perform make migrations and migrate commands,and after that i have created superuser for login into django admin interface ,and when i login into the django admin interface and add the record into the employee table using django admin interface , I get the operational error attached in the photo ,and I am not understanding why i am getting this,This is the complete info i can provide

In the window where you’re running runserver, you’ll have the complete traceback from the error.

Is this from a brand-new database as suggested earlier? Or is this from the original database referenced in the original post?


This is the traceback i am getting

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

This is the database related info in the settings.py and this is the new database

Please do not post images here of code / html / templates / etc. They can’t be searched, quoted in replies, and are not legible on all devices people use to read the forum.
Copy / paste the text of the traceback, enclosing it in the lines of three backticks as described earlier.

It looks like you may be running Python 3.9, but Django 2.0 only officially supports up to Python 3.7 Also, Django 2.0 has passed its End-of-life date - You should be at least on Django 2.2, which does support Python 3.9 as of 2.2.17.

Traceback (most recent call last):
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\exception.py", line 35, in inner
    response = get_response(request)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\admin\options.py", line 574, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\decorators.py", line 142, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\decorators\cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\admin\sites.py", line 223, in inner
    return view(request, *args, **kwargs)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\admin\options.py", line 1553, in add_view
    return self.changeform_view(request, None, form_url, extra_context)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\decorators.py", line 62, in _wrapper
    return bound_func(*args, **kwargs)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\decorators.py", line 142, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\decorators.py", line 58, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\admin\options.py", line 1450, in changeform_view
    return self._changeform_view(request, object_id, form_url, extra_context)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\admin\options.py", line 1494, in _changeform_view
    self.log_addition(request, new_object, change_message)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\admin\options.py", line 767, in log_addition
    return LogEntry.objects.log_action(
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\admin\models.py", line 23, in log_action
    return self.model.objects.create(
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\query.py", line 417, in create
    obj.save(force_insert=True, using=self.db)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\base.py", line 728, in save
    self.save_base(using=using, force_insert=force_insert,
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\base.py", line 759, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\base.py", line 842, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\base.py", line 879, in _do_insert
    return manager._insert([self], fields=fields, return_id=update_pk,
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\query.py", line 1125, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\sql\compiler.py", line 1280, in execute_sql
    cursor.execute(sql, params)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 100, in execute
    return super().execute(sql, params)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 303, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: main.auth_user__old
[30/Apr/2021 00:11:06] "POST /admin/testApp/employee/add/ HTTP/1.1" 500 211822

ok I have put traceback in the backticks

Ok i will try installing django version 2.2

Thank you very much ,it worked while installing django version higher than 2.2