i have a model in django admin, and that model have 2 inline models inside it as shown :
@ admin.register(Transaction)
class TransactionAdmin(admin.ModelAdmin):
inlines = [FamilyGroupInline, FamilyMemberInline]
fieldsets = (
(None, {
'fields': ('complete',),
}),
('Transaction Details', {
'fields': ('chp_reference', 'income_period', 'property_market_rent',
'rent_effective_date', 'number_of_family_group',),
}),
('Report', {
'classes': ('collapse',),
'fields': ('report',),
}),
)
im trying to customize the Transaction admin page, i want the two inline models be added automatically once i start a new Transaction, and dont have to click "add another ..."
button
what is the best approach to achieve that ? would appreciate your help!
question from:
https://stackoverflow.com/questions/65644708/how-to-auto-add-inline-models-in-django-admin-page 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…