Add Student inline to Klass admin
This commit is contained in:
parent
7261895102
commit
2a7f57859d
1 changed files with 12 additions and 0 deletions
|
|
@ -66,10 +66,22 @@ class KlassRelatedListFilter(admin.RelatedFieldListFilter):
|
|||
]
|
||||
|
||||
|
||||
class StudentInline(admin.StackedInline):
|
||||
model = Student
|
||||
ordering = ('last_name', 'first_name')
|
||||
fields = (
|
||||
('last_name', 'first_name', 'birth_date'),
|
||||
('pcode', 'city', 'tel', 'mobile', 'email'),
|
||||
)
|
||||
can_delete = False
|
||||
extra = 0
|
||||
|
||||
|
||||
class KlassAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'section')
|
||||
ordering = ('name',)
|
||||
list_filter = ('section', 'level',)
|
||||
inlines = [StudentInline]
|
||||
|
||||
|
||||
class TeacherAdmin(admin.ModelAdmin):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue