Do you have any message in the console where you run "python manage.py runserver" ?
2016-08-21 12:16 GMT+02:00 Jordi Fernandez <[email protected]>: > hi, > > I have my firts application django it's fine. . But! I have a problem with a > simple form. I think this is a problem the my experience of all entorn ( > html, form action, ..) > > the problem is when a submit my form is a eror -> ERROR LOADING PAGE > > if I test my script I not received a method post. why? > > > > thank you > > > This is my template form > > <form action="/crearassistenciaclasse/" method="post" >{% csrf_token %} > {{ form.name.errors }} > <!-- > <form action="/login/" method="POST" > > {% csrf_token %} > --> > > {{form.as_p}} > > <!-- > <button type="submit" class="save btn btn-default">Save</button> > --> > <input type="submit" value="Crear Assistencia"> > > </form> > > > this is my wiew > > def crearasistenciaclasse(request): > #return HttpResponse('ok') > > if request.method == "POST": > form = CrearasistenciaclasseForm(request.POST) > if form.is_valid(): > Asistencia = form.save() > return redirect('dojo.views.reportaralumnos') > else: > user = 6 > form = CrearasistenciaclasseForm(my_arg=user) > > return render_to_response('asistencias/crearasistenciaclasse.html', > {'form': form}) > > > > > > > > > > this is my form > > class CrearasistenciaclasseForm(forms.Form): > alumnos = forms.ModelChoiceField(queryset=Alumno.objects.all()) > classesobertes = > forms.ModelChoiceField(queryset=Classe.objects.filter(estado='A')) > def __init__(self, *args, **kwargs): > my_arg = kwargs.pop('my_arg') > super(CrearasistenciaclasseForm, self).__init__(*args, **kwargs) > > self.fields['classesobertes'].label = "Classe" > > self.fields['alumnos'].initial = my_arg > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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/71bb6ab8-e14a-47aa-91ad-57d4ac29e6f0%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Cordialement, Coues Ludovic +336 148 743 42 -- 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 [email protected]. To post to this group, send email to [email protected]. 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/CAEuG%2BTbsnWXo0iF0%2BaNwY3KV1AZXj74bCh4w3jrt86KL1RCTXQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

