Have you called form.is_valid() somewhere that you're not showing? On Wed, Nov 9, 2011 at 7:15 AM, Asif Jamadar <asif.jama...@rezayat.net> wrote: > I’m assigning initial data to the field of each formset dynamically. But > when I’m trying to save that initial data it’s throwing “Key Error” in > cleaned data. Any solution? > > > > > > Here is the code: > > > > In views.py > > > > for form in formset.forms: > > > > question = form.save(commit=False) > > > > answer_value = form.cleaned_data['answer'] > > > > shade_value = form.cleaned_data['shade'] > > > > # rest of the code goes here > > > > question.save() > > > > > > Here ‘answer’ and ‘shade’ are choicefield. > > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. >
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.