Tuesday, August 30, 2016

simple form, beginner


<form action="." method="post" enctype="multipart/form-data"> {% csrf_token %}



<form action="" method="post" enctype="multipart/form-data"> {% csrf_token %}


the two instrucctions not working, my view not received nothing  post i want a form with the same view.

remember I am Beginner!

thank you


def crearasistenciaclasse(request):
    user = 6
    form = CrearasistenciaclasseForm(my_arg=user)
    if request.method == 'POST' :
       return HttpResponse('ok')
       form = CrearasistenciaclasseForm(request.POST)
       if form.is_valid():
           crearasistenciaclasse = Crearasistenciaclasse (alumno=form_cleaned_data[alumnos],
                                                          classe=form_cleaned_data[classesobertes])
           crearasistenciaclasse.save()
           return redirect('dojo.views.reportaralumnos')
    else:
           #assert False, locals()
           user = 6
           form = CrearasistenciaclasseForm(my_arg=user)
           
          
    return render_to_response('asistencias/crearasistenciaclasse.html', {'form': form},
                                 context_instance=RequestContext(request))





--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/af425b7a-a8cf-41b6-88c9-5ffcc3d3fb19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment