def choices_form(request): BIRTH_YEAR_CHOICES = ('1980', '1981', '1983') cd=[] if request.method == 'POST': form = ChoicesForm(BIRTH_YEAR_CHOICES,request.POST) if form.is_valid(): cd = form.cleaned_data return render(request,'forms/choices_processing.html',{'form':form,'cd':cd}) else: form = ChoicesForm(BIRTH_YEAR_CHOICES) return render(request,'forms/choices_form.html',{'form':form, 'cd':cd})
def choices_processing(request): form = ChoicesForm(request.GET) form.is_valid() cd = form.cleaned_data return render_to_response('forms/choices_processing.htmls',{'cd':cd})