Hi group ,
I am getting error like "Key 'fathers_photo' not found in
<QueryDict:   and this is what i have done

forms.py
class FatherProfileForm(forms.Form):
    fathers_photo = forms.ImageField(required=False)
    fathers_mobile_phone=forms.CharField(max_length=20,required=False)

views.py
def father_add(request):
   postdict=request.POST.copy()
   #fatherprofileform=FatherProfileForm(request.POST,request.FILES)
   fatherprofileform=FatherProfileForm(postdict)
   if fatherprofileform.is_valid():
       fp=postdict['fathers_photo']
       fmp=postdict['fathers_mobile_phone']
       fatherprofileobj=UserProfile.objects.create
(photo=fp,mobile_phone=fmp)
       fatherprofileobj .save()

father_add.html
<form enctype="multipart/form-data" action="" method="POST">
{{fatherprofileform.as_p}}
<input type=submit value=go/>
</form>



Here FatherProfileForm does not represent UserProfile model .In this
case how can the error be rectified ?


Ganesh

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.


Reply via email to