So Im using pycharm and trying to learn django watching a few tutorials on youtube. Been following exactly how the instructors have been doing it but every time I try to create an instance of a model I created I get this error. I've seen the question with a few answers and I've tried 'python manage.py makemigrations' & 'python manage.py migrate' but im still getting no result.
Error:
OperationalError at /admin/products/product/add/
no such table: main.auth_user__old
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/products/product/add/
Django Version: 2.0.7
Exception Type: OperationalError
Exception Value:
no such table: main.auth_user__old
Exception Location: E:\Python\PythonWorkspace\Django_Unchained\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 303
Python Executable: E:\Python\PythonWorkspace\Django_Unchained\venv\Scripts\python.exe
Python Version: 3.9.6
Python Path:
['E:\\Python\\PythonWorkspace\\Django_Unchained',
'E:\\Python\\python39.zip',
'E:\\Python\\DLLs',
'E:\\Python\\lib',
'E:\\Python',
'E:\\Python\\PythonWorkspace\\Django_Unchained\\venv',
'E:\\Python\\PythonWorkspace\\Django_Unchained\\venv\\lib\\site-packages']
Server time: Fri, 13 Aug 2021 17:32:50 +0000
products.models.py
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=50)
desc = models.CharField(max_length=255)
price = models.FloatField()
stock = models.IntegerField()
products.admin.py
from django.contrib import admin
from .models import Product
admin.site.register(Product)
django_unchained.settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'products'
]