Tks you all... I forgot it, it is now fixed.
regards
____________________
Israel Fdez. Cabrera
[EMAIL PROTECTED]
UNYK : 936 LDX
Linux registered user No.: 270292 [http://counter.li.org]
. 0 .
. . 0
0 0 0
On Wed, Nov 12, 2008 at 13:17, Daniel Roseman <[EMAIL PROTECTED]
> wrote:
>
> On Nov 12, 5:52 pm, "Israel Fdez. Cabrera" <[EMAIL PROTECTED]> wrote:
> > 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
>
> The immediate problem is that you're not using enctype="multipart/form-
> data" in your form tag. See here:
>
> http://docs.djangoproject.com/en/dev/ref/forms/api/#binding-uploaded-files-to-a-form
>
> You're also not displaying any non-field errors, which might have
> shown you what the problem was with validation.
> --
> DR.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---