'django - get values from formset
I've tried to get value from formset do some calculations and pass the output. My code is:
def form_valid(self, form, formset):
rndid2 = RndIds()
form.instance.doc_added_by = self.request.user
form.instance.doc_guid = rndid2.random_doc_guid()
instances = formset.save(commit=False)
for instance in instances:
cd = instance.cleaned_data()
at_id=cd.get('att_guid')
instance.att_added_by = str(self.request.user)
instance.att_ctrl_sum = rndid2.random_doc_application_id(at_id)
instance.save()
return HttpResponseRedirect(self.get_success_url())
But got an error
'Att' object has no attribute 'cleaned_data'
Att is my model
How can I get the formset values?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
