W
W
wolverine7772020-05-24 01:38:47
Django
wolverine777, 2020-05-24 01:38:47

Why is there a "no such table: main.auth_user__old" error?

Hi I'm trying to learn django and am in the process of adding a test "product" in admin mode.

Went to 127.0.0.1:8000/admin further under the Products section that I created earlier in admin.py

from django.contrib import admin
from .models import Product
admin.site.register(Product)


and also in models.py

class Offer(models.Model):
    code = models.CharField(max_length=10)
    description = models.CharField(max_length=255)
    discount = models.FloatField()


... I click + Add

, then I fill in all the required fields, click on Save and ... I get the following 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.1
Exception Type:	OperationalError
Exception Value:	
no such table: main.auth_user__old
Exception Location:	C:\Users\dmitr\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 296
Python Executable:	C:\Users\dmitr\PycharmProjects\PyShop\venv\Scripts\python.exe
Python Version:	3.7.4
Python Path:	
['C:\\Users\\dmitr\\PycharmProjects\\PyShop',
 'C:\\Users\\dmitr\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.zip',
 'C:\\Users\\dmitr\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs',
 'C:\\Users\\dmitr\\AppData\\Local\\Programs\\Python\\Python37-32\\lib',
 'C:\\Users\\dmitr\\AppData\\Local\\Programs\\Python\\Python37-32',
 'C:\\Users\\dmitr\\PycharmProjects\\PyShop\\venv',
 'C:\\Users\\dmitr\\PycharmProjects\\PyShop\\venv\\lib\\site-packages',
 'C:\\Users\\dmitr\\PycharmProjects\\PyShop\\venv\\lib\\site-packages\\setuptools-39.1.0-py3.7.egg',
 'C:\\Users\\dmitr\\PycharmProjects\\PyShop\\venv\\lib\\site-packages\\pip-10.0.1-py3.7.egg']
Server time:	Sat, 23 May 2020 22:35:43 +0000


looked at the stack ( https://stackoverflow.com/questions/36123312/djang... ) - they say that you just need

python manage.py migrate

python manage.py makemigrations
python manage.py migrate


But this does not help ...

The problem is some very simple, but I don’t understand what’s wrong.

Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
W
wolverine777, 2020-05-25
@wolverine777

All that was needed was:
On the advice of various people, upgrade django to 2.1.5 Delete the SQLite database (you can just manually delete from the project) Migrate again and then Restart DONE! pip install django==2.1.5

A
Arseny, 2020-05-24
Matytsyn @ArsenyMatytsyn

They say correctly on the stack, you need to enter your instructions using migrations into the database.
You need to read about them in your native documentation , and / or find a translation into Russian. They [translations] are.

D
Dr. Bacon, 2020-05-24
@bacon

1. the Product model is connected in the admin panel, and the Offer model is shown to
us

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question