Tuesday, August 30, 2016

Re: beginner . problem simple form.


yes  , we are test
El dilluns, 22 agost de 2016 22:38:39 UTC+2, ludovic coues va escriure:
The second form tag is in an html comment. Everything inside <!-- -->
won't be rendered.

2016-08-22 14:31 GMT+02:00 Vijay Khemlani <vkhe...@gmail.com>:
> Also, why do you have two form tags in your html?
>
> On Sun, Aug 21, 2016 at 10:40 AM, ludovic coues <cou...@gmail.com> wrote:
>>
>> 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 <fernand...@gmail.com>:
>> > 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 django-users...@googlegroups.com.
>> > To post to this group, send email to django...@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/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 django-users...@googlegroups.com.
>> To post to this group, send email to django...@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/CAEuG%2BTbsnWXo0iF0%2BaNwY3KV1AZXj74bCh4w3jrt86KL1RCTXQ%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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...@googlegroups.com.
> To post to this group, send email to django...@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/CALn3ei3ReDgYhXY4yabQ2v-QMNcLD5tzOadoxC9cxTaBcPP-cQ%40mail.gmail.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 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/dfb01891-78d1-473e-b137-c774349988ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment