[英]I'm trying to add new product on my new project. But why it's show (no such table: main.auth_user__old)
I'm trying to add new product details on product table.我正在尝试在产品表上添加新的产品详细信息。 But whenever I try to save this it's show me
但是每当我尝试保存它时,它都会向我展示
OperationalError at /admin/products/product/add/ /admin/products/product/add/ 处的操作错误
*Here are errors detail: * Environment: *这里是错误的详细信息:*环境:
Request Method: POST Request URL: http://127.0.0.1:8000/admin/products/product/add/请求方式:POST 请求地址: http : //127.0.0.1 : 8000/admin/products/product/add/
Exception Type: OperationalError at /admin/products/product/add/ Exception Value: no such table: main.auth_user__old异常类型:OperationalError at /admin/products/product/add/ 异常值:没有这样的表:main.auth_user__old
This is model这是模型
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=255)
price = models.FloatField()
stock = models.IntegerField()
image_url = models.CharField(max_length=2088)
class Offer(models.Model):
code = models.CharField(max_length=10)
description = models.CharField(max_length=255)
discount = models.FloatField()
admin行政
from django.contrib import admin
from .models import Product
admin.site.register(Product)
I don't know if you are still struggling with this, but I had the same issue.我不知道你是否还在为此苦苦挣扎,但我遇到了同样的问题。 The solution was deleting and re-downloading
db.sqlite3
with an older version of django.解决方案是使用旧版本的 django 删除并重新下载
db.sqlite3
。
pip install django==2.1.7
pip install django==2.1.7
db.sqlite3
file in your root folder.db.sqlite3
文件。 (Search for it in your PyCharm projects in the root folder if that's where it's stored) db.sqlite3
by doing python manage.py makemigrations
db.sqlite3
做python manage.py makemigrations
python manage.py makemigrations
run python manage.py migrate
.python manage.py makemigrations
运行python manage.py migrate
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.