We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7db5b78 commit a4d1505Copy full SHA for a4d1505
resources/session08/mysite_stage_3/myblog/admin.py
@@ -4,5 +4,17 @@
4
from myblog.models import Post
5
6
7
-admin.site.register(Category)
8
-admin.site.register(Post)
+class CategoryInline(admin.TabularInline):
+ model = Category.posts.through
9
+
10
+class PostAdmin(admin.ModelAdmin):
11
+ inlines = [
12
+ CategoryInline,
13
+ ]
14
15
+class CategoryAdmin(admin.ModelAdmin):
16
+ exclude = ('posts', )
17
18
19
+admin.site.register(Category, CategoryAdmin)
20
+admin.site.register(Post, PostAdmin)
0 commit comments