Django管理面板模型在主页中

huangapple go评论114阅读模式
英文:

Django admin panel model in main page

问题

我有一些管理模型,如何在管理面板主页面上显示其中一个管理模型,以便在不必单击管理面板主页上的模型的情况下显示此模型的字段。与下面的图片类似,我需要在主管理页面中显示在框内的模型字段。

Django管理面板模型在主页中

英文:

I have few admin models, how can I display one of the admin models in the admin panel main page so the fields of such model show without having to click on the model in admin panel homepage. Similar to the image below, a model field inside a box showing in the main admin page is what I need.

Django管理面板模型在主页中

答案1

得分: 1

前往您的应用目录中的 'admin.py' 文件

然后添加如下内容:

from django.contrib import admin
from .models import *
# 在这里注册您的模型

admin.site.register(Book)
admin.site.register(Tag)
admin.site.register(Language)
英文:

Go to 'admin.py' in your app directory

and add like this

from django.contrib import admin
from .models import *
# Register your models here.

admin.site.register(Book)
admin.site.register(Tag)
admin.site.register(Language)

huangapple
  • 本文由 发表于 2023年3月7日 13:28:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/75658322.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定