下面是我的代码
class CommentInline(admin.StackedInline):
model= Comments
extra=0
template = "admin/comments.html"
class BlogAdmin(admin.ModelAdmin):
inlines = [CommentInline]
admin.site.register(Blog,BlogAdmin)
在comments.html文件中
{% for comments in comments_list %}
{{ comments.name }}
{% endfor %}
但它不打印任何内容,但如果使用默认模板,它将打印值
我只是尝试使用不同的模板内联类
目前没有回答
相关问题 更多 >
编程相关推荐