在管理员上注册课程,但不显示 [英] Have registered class on admin, but it doesn't show up
本文介绍了在管理员上注册课程,但不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的admin.py。我自己创建了这个文件,不知道我是否需要在设置中注册。
This is my admin.py. I have created the file by myself and don't know if I need to register it somewhere in settings.
from django.contrib import admin
from .models import Athlete
admin.site.register(Athlete)
这是我的models.py:
This is my models.py:
from django.db import models
class Athlete(models.Model):
firstName = models.CharField(max_length=30)
lastName = models.CharField(max_length=30)
这两个文件都在我的项目文件夹中。我没有任何应用程式当我去 url / admin /
我希望能够创建和编辑运动员,但我只能编辑组和用户。
Both files are in my project folder. I don't have any apps. When I go to url/admin/
I expect to be able to create and edit athletes, but I can only edit groups and users.
我还需要做什么来使运动员在管理员中可以编辑?
What more do I need to do to make Athletes editable in admin?
推荐答案
将您的模块添加到设置中INSTALLED_APPS列表。可能你忘了它(就像你在评论中猜到的那样)。
Add your module into settings INSTALLED_APPS list. Probably you forgot it (as you guess in your comment).
这篇关于在管理员上注册课程,但不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文