Alfredo Alessandrini wrote:
> def setup_player(request):
> if request.method == 'POST':
> form = PlayerForm(request.POST)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect(form_successfully)
> else:
> form = PlayerForm()
> return render_to_response('player_form.html', {'form': form})
def setup_player(request):
if request.method == 'POST':
form = PlayerForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect(form_successfully)
else:
form = PlayerForm()
return render_to_response('player_form.html', {'form': form})
notice the last three lines
the usual pattern is
if POST:
form = MyForm(POST)
if form.is_valid():
return HttpResponseRedirect('all_ok.html')
else: # no POST data
form = MyForm()
return render_to_response(..., {...})
--
()_() | That said, I didn't actually _test_ my patch. | +----
(o.o) | That's what users are for! | +---+
'm m' | (Linus Torvalds) | O |
(___) | raffaele at salmaso punto org |
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---