On Aug 20, 10:37 am, luca72 <lucabe...@libero.it> wrote:
> Hello i have made this it works, but i'm sure that there is a short
> way to obtain the same result can you tell me how?
>
> def richiedi(request):
>     if request.method == 'POST':
>         form = RichiestaForm(request.POST)
>         if form.is_valid():
>             tipo = form.cleaned_data['tipo']
>             nome_rich = form.cleaned_data['nome_rich']
>
>             luca = Richiesta(tipo=tipo,nome_rich=nome_rich)
>             luca.save()
>             grazie = 'test'
>             return render_to_response('grazie.html',
> {'grazie':grazie})
>     else :
>         form = RichiestaForm()
>         return render_to_response('richiedi.html',{'form': form})
>
> Thanks
>
> Luca

Yes: use a modelform. You haven't explained why you don't want to use
one. Your other thread just asked how to do it without a modelform,
and this is the answer to that. But the answer to do it with less code
is to use one.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to