Add inline model to django admin site
ADD in admin.py
from .models import Post, Comment
class CommentInline(admin.StackedInline):
model = Comment
extra = 0
class PostAdmin(admin.ModelAdmin):
inlines = [
CommentInline,
]
admin.site.register(Post, PostAdmin)
Click on this: result
do something like this:
class ChannelAdmin(admin.TabularInline):
model = Channel
class RuleAdmin(admin.ModelAdmin):
inlines = [ChannelAdmin,]
admin.site.register(Rule,RuleAdmin)
class OrderItemInline(admin.TabularInline):
model = OrderItem
fields = ['image']
class OrderAdmin(admin.ModelAdmin):
list_display = ['id']
list_filter = ['status']
inlines = [OrderItemInline]