试图更好地理解 Django Admin,但在 django admin 中放置嵌套字段集时遇到问题
我想对我的模型字段进行分组,如下图所示。
我尝试使用此代码,但没有成功。
class ContactAdmin(admin.ModelAdmin):
fieldsets = (
("Main Info", {'fields': ("user", "website")}),
("Phones", {'fields': (
("Primary", {'fields': (("primary_phone_country", "primary_phone_area", "primary_phone_number"),)}),
("Secondary", {'fields': (("secondary_phone_country", "secondary_phone_area", "secondary_phone_number"),)}),
)}),
)
admin.site.register(Contact, ContactAdmin)
有解决上述问题的解决方案吗?