我已经重写了save_formset方法来从管理页面中提取数据。我的代码是这样的,
def save_formset(self, request, form, formset, change):
for f in formset:
print('Voter address is: ', f['voter_address'] )
super().save_formset(request,form, formset, change)我得到的输出

但我想提取实际价值,这是“克伦克拉斯”,第二,我想知道,没有价值存在。我怎么能做到这一点?
发布于 2017-03-28 07:44:42
def save_formset(self, request, form, formset, change):
# Create instances. Each instance will be a "row" (obj) of the inline model
instances = formset.save(commit=False)
# Iterate over the instances (objects of the Inline Model)
for instance in instances:
# Get the object's attribute (Model field)
print(instance.voter_address)
super().save_formset(request,form, formset, change)https://stackoverflow.com/questions/43054736
复制相似问题