在我的django应用程序上,我尝试注册模型,python www.example.com makemigrations,migrate工作,但在admin上找不到数据库表。manage.py makemigrations , migrate works , but no database table found on admin..
网站admin.py
from django.contrib import admin..
from .models import Product
class ProductAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('product_name',)}
list_display = ('product_name', 'price', 'stock', 'category', 'modified_date', 'is_available')
admin.site.register(Product, ProductAdmin)
1条答案
按热度按时间31moq8wy1#
首先,确保您的应用程序已在
INSTALLED APPS
内的settings.py
文件中注册然后运行
python manage.py appname
,然后作为python manage.py migrate appname
迁移