On Mar 31, 10:04 pm, Michael <[EMAIL PROTECTED]> wrote:
> Not really a DRY issue moreover there is an easier logic to your code:
Sad that I didn't see that.
Thanks,
Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Group
Not really a DRY issue moreover there is an easier logic to your code:
if request.method == 'POST':
form = MyForm(request.POST)
if form.is_valid():
# make new model object and save
return HttpResponseRedirect('/')
else:
form = MyForm(initial=data)
return render_to_response('templa
I find myself doing this a lot in view code
if request.method == 'GET':
form = MyForm(initial=data)
return render_to_response('template.html',
RequestContext(request, {
'foo': foo,
'bar': bar
}))
elif request.method == 'POST':
form = MyForm(request.POST)
3 matches
Mail list logo