Fixed special Student edition case where inlines differ between GET and POST
This commit is contained in:
parent
3ac41b0188
commit
be3958af40
1 changed files with 6 additions and 0 deletions
|
|
@ -207,6 +207,12 @@ class StudentAdmin(admin.ModelAdmin):
|
|||
inlines = [inl for inl in inlines if inl != SupervisionBillInline]
|
||||
if not obj.is_ede() and not obj.is_eds():
|
||||
inlines = [inl for inl in inlines if inl != ExaminationInline]
|
||||
if request.method == 'POST':
|
||||
# Special case where inlines would be different before and after POST
|
||||
if SupervisionBillInline in inlines and not 'supervisionbill_set-TOTAL_FORMS' in request.POST:
|
||||
inlines.remove(SupervisionBillInline)
|
||||
if ExaminationInline in inlines and not 'examination_set-TOTAL_FORMS' in request.POST:
|
||||
inlines.remove(ExaminationInline)
|
||||
return inlines
|
||||
|
||||
def get_fieldsets(self, request, obj=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue