view gpp/polls/forms.py @ 177:9b63ad1f2ad2

Fixing #59, again. Django ticket 13093 was fixed allowing cache_page to work in the URLconf.
author Brian Neal <bgneal@gmail.com>
date Mon, 15 Mar 2010 03:26:38 +0000
parents dbd703f7d63a
children 1f139de929c4
line wrap: on
line source
"""Forms for the Polls application."""

from django import forms

from polls.models import Choice


class VoteForm(forms.Form):
   """Form for voting in a poll."""
   choices = forms.ModelChoiceField(label='', empty_label=None,
         queryset=Choice.objects.none(), widget=forms.RadioSelect)

   def __init__(self, poll, *args, **kwargs):
      super(VoteForm, self).__init__(*args, **kwargs)
      self.fields['choices'].queryset = poll.choice_set.all()