Added supervision bill for student EDE
This commit is contained in:
parent
5d620a228a
commit
5fc33f9b44
4 changed files with 75 additions and 2 deletions
|
|
@ -13,7 +13,7 @@ from django.utils.html import format_html
|
|||
from .models import (
|
||||
Teacher, Option, Student, Section, Level, Klass, Corporation,
|
||||
CorpContact, Domain, Period, Availability, Training, Course,
|
||||
LogBookReason, LogBook, ExamEDESession
|
||||
LogBookReason, LogBook, ExamEDESession, SupervisionBill
|
||||
)
|
||||
from .pdf import ChargeSheetPDF
|
||||
|
||||
|
|
@ -106,6 +106,11 @@ class TeacherAdmin(admin.ModelAdmin):
|
|||
inlines = [LogBookInline]
|
||||
|
||||
|
||||
class SupervisionBillInline(admin.TabularInline):
|
||||
model = SupervisionBill
|
||||
extra = 0
|
||||
|
||||
|
||||
class StudentAdmin(admin.ModelAdmin):
|
||||
list_display = ('__str__', 'pcode', 'city', 'klass', 'archived')
|
||||
ordering = ('last_name', 'first_name')
|
||||
|
|
@ -139,6 +144,14 @@ class StudentAdmin(admin.ModelAdmin):
|
|||
}),
|
||||
)
|
||||
actions = ['archive']
|
||||
inlines = [SupervisionBillInline]
|
||||
|
||||
def get_inline_instances(self, request, obj=None):
|
||||
# SupervisionBillInline is only adequate for EDE students
|
||||
if obj is None or obj.klass.section.name != 'EDE':
|
||||
return []
|
||||
return super().get_inline_instances(request, obj=obj)
|
||||
|
||||
def archive(self, request, queryset):
|
||||
for student in queryset:
|
||||
# Save each item individually to allow for custom save() logic.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue