0

I'm creating my first Django project. I am getting an error when I press the save button after adding the data to the text fields inside the products. This is the error I get:

OperationalError at /admin/products/product/add/

no such table: main.auth_user__old

Request Method:     POST
Request URL:    http://127.0.0.1:8080/admin/products/product/add/
Django Version:     2.1
Exception Type:     OperationalError
Exception Value:    

no such table: main.auth_user__old

Exception Location:     C:\Users\Ehtsham\PycharmProjects\firstproject\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 296
Python Executable:  C:\Users\Ehtsham\PycharmProjects\firstproject\venv\Scripts\python.exe
Python Version:     3.8.1
Python Path:    

['C:\\Users\\Ehtsham\\PycharmProjects\\firstproject',
 'C:\\Users\\Ehtsham\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip',
 'C:\\Users\\Ehtsham\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs',
 'C:\\Users\\Ehtsham\\AppData\\Local\\Programs\\Python\\Python38-32\\lib',
 'C:\\Users\\Ehtsham\\AppData\\Local\\Programs\\Python\\Python38-32',
 'C:\\Users\\Ehtsham\\PycharmProjects\\firstproject\\venv',
 'C:\\Users\\Ehtsham\\PycharmProjects\\firstproject\\venv\\lib\\site-packages',
 'C:\\Users\\Ehtsham\\PycharmProjects\\firstproject\\venv\\lib\\site-packages\\setuptools-40.8.0-py3.8.egg',
 'C:\\Users\\Ehtsham\\PycharmProjects\\firstproject\\venv\\lib\\site-packages\\pip-19.0.3-py3.8.egg']

Server time:    Sun, 5 Jan 2020 15:00:27 +0000

I also did migrations before:

(venv) C:\Users\Ehtsham\PycharmProjects\firstproject>python manag
e.py makemigrations
Migrations for 'products':
  products\migrations\0002_offers.py
    - Create model Offers

(venv) C:\Users\Ehtsham\PycharmProjects\firstproject>python manag
e.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, products, sess
ions
Running migrations:
  Applying products.0002_offers... OK

I'm using Django version 2.1 and SQLite DB browser on PyCharm IDE.

1 Answers1

0

It shows your django version is "Django Version:2.1"

You need to upgrade your django. if its a new project. Please do the following steps.

step:1>> pip install Django --upgrade

step:2 >> python manage.py makemigrations

Step:3 >> python manage.py migrate

Ste:-4 >> python manage.py runserver

Iqbal Hussain
  • 1,077
  • 1
  • 4
  • 12