django的一个ModelForm
中是否可能包含多个型号?我正在try 创建一个个人资料编辑表单.所以我需要包括一些来自用户模型and和用户配置文件模型的字段.目前我正在使用两种类似的表单
class UserEditForm(ModelForm):
class Meta:
model = User
fields = ("first_name", "last_name")
class UserProfileForm(ModelForm):
class Meta:
model = UserProfile
fields = ("middle_name", "home_phone", "work_phone", "cell_phone")
有没有办法把这些整合到一个表单中,或者我只需要创建一个表单,处理数据库加载并保存自己?