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

--~--~---------~--~----~------------~-------~--~----~
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