gremmie@1: """Forms for the Polls application.""" gremmie@1: gremmie@1: from django import forms gremmie@1: gremmie@1: from polls.models import Choice gremmie@1: gremmie@1: gremmie@1: class VoteForm(forms.Form): gremmie@1: """Form for voting in a poll.""" gremmie@1: choices = forms.ModelChoiceField(label='', empty_label=None, gremmie@1: queryset=Choice.objects.none(), widget=forms.RadioSelect) gremmie@1: gremmie@1: def __init__(self, poll, *args, **kwargs): gremmie@1: super(VoteForm, self).__init__(*args, **kwargs) gremmie@1: self.fields['choices'].queryset = poll.choice_set.all() gremmie@1: