On 30-Sep-06, at 8:50 AM, RajeshD wrote: > What does your view function look like?
this is from the view: class PollManipulator(forms.Manipulator): 422 def __init__(self): 423 self.fields = ( 424 forms.CheckboxField(field_name="vote") 425 ) 426 427 def addpoll(request,code): 428 """view to add a poll 429 """ 430 if code: 431 try: 432 usr = Tempoll.objects.get(code__exact=code) 433 data = {} 434 if usr: 435 data["email"]=usr.email 436 data["code"]=code 437 except: 438 return HttpResponseRedirect("/web/sorry/") 439 manipulator=PollManipulator() 440 if request.POST: 441 errors = {} 442 data = request.POST.copy() 443 444 if not errors: 445 manipulator.do_html2python(data) 446 poll = Poll(email = data["email"], 447 vote = data['vote']) 448 449 poll.save() 450 return HttpResponseRedirect("/web/pollsuccess/%i/" 451 % user.id) 452 453 else: 454 errors = {} 455 new_data = {} 456 form = forms.FormWrapper(manipulator, new_data, errors) 457 return render_to_response('web/poll.html', {'form':form, 458 'email': usr.email, 459 'code':code}) and this is the template: {% extends "base.html" %} 2 {% load i18n %} 3 {% block centercontent %} 4 <h1>{% trans "vote" %}</h1> 5 <h2>Ilug Chennai vote by {{ email }}</h2> 6 {% if form.has_errors %} 7 <h2>{% trans "Please correct the follwing errors:" %}</h2> 8 {% endif%} 9 10 <form method="POST" action="."> 11 <input type="hidden" name="code" value="{{ code }}"/> 12 <input type="hidden" name="email" value="{{ email }}"/> 13 <table border="1"> 14 15 <TR> 16 <p>{{ form.vote }}<label for="id_vote">{% trans "vote:" %}</label> 17 </p> 18 </TR> 19 20 <tr><TD colspan="2" align="center"><input type="submit" name="submit" 21 value="{% trans "submit" %}"></TD></tr> 22 </table> 23 </form> 24 {% endblock %} and the result is attached: --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---
-- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/