Hi:

I'm trying to upload some CSV file I need to import into a database;
to do so I have the following Django form:

<source lang="python">

class CaptureEquipmentForm(forms.Form):
   area = forms.FileField()
   equipo = forms.FileField()
   tipo = forms.FileField()

</source>

this Django template:

<source lang="HTML">

<div id="formContainer">
   <form method="post" action="/ea/{{code}}/+equipamiento/">
       <fieldset>
       <legend>Capturar las tablas:</legend>
           <table>
               <tr><th>{{ form.area.label_tag }}</th><td>
{{ form.area }} {{ form.area.errors }}</td></tr>
               <tr><th>{{ form.equipo.label_tag }}</th><td>
{{ form.equipo }} {{ form.equipo.errors }}</td></tr>
               <tr><th>{{ form.tipo.label_tag }}</th><td>
{{ form.tipo }} {{ form.tipo.errors }}</td></tr>
           </table>
       </fieldset>
       <input type="submit" value="Capturar"/>
   </form>
</div>

</source>

and this view:

<source lang="python">

def captureEquipment(request, id_ea):
   if request.method == "POST":
       f = CaptureEquipmentForm(request.POST, request.FILES)
       print request.FILES
       if f.is_valid(): #The form never validates
           return HttpResponseRedirect("/map")
   else:
       f = CaptureEquipmentForm()
   return renderTemplate("Capturar Equipamiento",
                         template="eainfo/captureEquipment.xhtml",
                         initialContext={"form": f, "code": id_ea})

</source>

The problem is that in the view the form never validates, it always
behaves like if the form were submitted with all fields blank.

Any hint?

regards and thks in advance
Israel

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to