....
if request.POST:
new_data = request.POST.copy()
datos = request.POST.copy()
msg_error = comprobar_errores_evaluacion(new_data, bloques,
formato_tiempo)
if msg_error=="":
[...]
> this part is not execute becasuse we have errors in the form. So go, to
the end to send back the same template: 'deportista/evaluacion.html', get
the "bloques" and send them back
bloques = sesion.get_bloques('PP')
for bloque in bloques:
a_evaluar += bloque.datos_a_evaluar()
if a_evaluar == 0:
try:
sesion.fecha_realizacion = request.session["fecha_realizacion"]
sesion.fecha_confirmacion =
request.session["fecha_confirmacion"]
except:
sesion.fecha_realizacion = datetime.date.today()
sesion.fecha_confirmacion = datetime.date.today()
sesion.save()
return HttpResponseRedirect('/sportsound/deportista/')
return render_to_response('deportista/evaluacion.html', { 'title':
"Evaluar Sesión",
'datepicker': True,
'menu_activo':
"Entrenamiento",
'sesion':sesion,
'tiempo_sesion':tiempo_sesion,
'bloques': bloques,
'rango_diez':
rango_diez,
'deportista':
deportista,
'msg_error':
msg_error,
'accion':accion,
'intensidades':
Evaluacion_usuario.OPCIONES_INTENSIDAD,
},
context_instance=RequestContext(request))
Miguel
Sent from Madrid, Spain
On Tue, May 12, 2009 at 1:05 PM, Daniel Roseman <
[email protected]> wrote:
>
> On May 12, 11:37 am, Miguel <[email protected]> wrote:
> > Hi all,
> >
> > I have a dynamic form with lot of fields. The problem is that in case of
> > error, the failed field is indicated to the user but the user must
> rewrite
> > the rest of the fields.
> > I am sure it may be a way to post the not error fields back to the form
> when
> > this form is displayed again but I don't find it in the documentation.
> >
> > Is it posible to do what I have commented? The template is the same for
> lot
> > of forms with lot of fields and it is not worthy to get one by one all
> the
> > parameters.
> >
> > thank you, cheers
> >
> > Miguel
> > Sent from Madrid, Spain
>
> This should happen automatically. When you instantiate the form
> passing in request.POST, all the form fields are populated - so if it
> fails validation and gets redisplayed, the fields should be filled in.
>
> Can you post your code, so we can see what's going wrong?
> --
> 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
-~----------~----~----~----~------~----~------~--~---