this is my form after thomas reply:
<form enctype="multipart/form-data" action="" method="POST" >
                                 {{ form.as_p }}
                                 <input type="submit" value="Submit" /
>
                              </form>

and this is my view after your reply :

def careerspage(request):
  if request.method == 'POST':
        form = CareerForm(request.POST,request.FILES)
        if form.is_valid():
           form.save()
           return HttpResponseRedirect('/thanks')
  else:
        form = CareerForm()
  return render_to_response('careers.html', {'form':form})

the validation for the resume upload still failing when i submit
im reading the link u have posted to check whats wrong another help
will be appriciated :)

On May 19, 4:27 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Tue, May 19, 2009 at 5:23 AM, watad <awa...@gmail.com> wrote:
> > i have a model Career
>
> > class Career(models.Model):
> >  full_name = models.CharField(max_length=200)
> >  email = models.EmailField()
> >  nationality = CountryField()
> >  resume = models.FileField(upload_to='resumes')
> >  def __unicode__(self):
> >        return self.full_name
>
> > and i have the model form:
> > class CareerForm(ModelForm):
> >    class Meta:
> >        model = Career
>
> > inside my template im using :
>
> > {{ form.as_p }} to display the form
>
> > i can see the fileds but when i try to submit , the rusume validation
> > is always failing (This field is required.)
> > although i upload the file, and i was able to add data usign the admin
> > interface without any problems
>
> > any ideas about this issue
>
> The template (or at least the part that includes the form definition) you
> use for the form would have been helpful to post, as  that would have shown
> whether you had the enctype="multipart/form-data" mentioned by Thomas.
>
> The other part you haven't shown is how you create the form from the post
> data in the view.  My guess would be you are not passing request.FILES in
> when you instantiate the form.  See:
>
> http://docs.djangoproject.com/en/dev/topics/http/file-uploads/
>
> Karen- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to