Skip to content

Commit bc786b3

Browse files
renzonrenzon
authored andcommitted
Implemented Chapter Inline
close #348
1 parent 13f45b9 commit bc786b3

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎pythonpro/modules/admin.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.contrib import admin
2+
from django.contrib.admin import StackedInline
23
from django.utils.safestring import mark_safe
34
from ordered_model.admin import OrderedModelAdmin
45

@@ -25,8 +26,16 @@ class SectionAdmin(BaseAdmin):
2526
list_display = 'title slug module order move_up_down_links page_link'.split()
2627

2728

29+
class TopicInline(StackedInline):
30+
model = Topic
31+
prepopulated_fields = {'slug': ('title',)}
32+
extra = 1
33+
ordering = ('order',)
34+
35+
2836
@admin.register(Chapter)
2937
class ChapterAdmin(BaseAdmin):
38+
inlines = [TopicInline]
3039
list_display = 'title slug section order move_up_down_links page_link'.split()
3140

3241

0 commit comments

Comments
 (0)