【发布时间】:2014-08-23 08:55:51
【问题描述】:
基于this 关于formset_factory 的回答,我尝试为modelformset_factory 做同样的事情:
from django.utils.functional import curry
from functools wraps
AccountMemberFormSetBase = modelformset_factory(AccountMember,
form=wraps(AccountMemberLimitedModelForm)(curry(AccountMemberLimitedModelForm, affiliate="test")),
extra=2)
这会引发以下错误:
function() argument 1 must be code, not str
Exception Location: ../django/forms/models.py in modelform_factory, line 528
知道这里有什么问题吗?
【问题讨论】:
-
你能显示完整的回溯吗?另外,您使用的是什么 django 版本?
-
Django 1.6 - 将很快发布完整的回溯
-
这里是完整的回溯:pastebin.com/htt0ANFi
标签: python django forms formset