comparison gpp/polls/forms.py @ 1:dbd703f7d63a

Initial import of sg101 stuff from private repository.
author gremmie
date Mon, 06 Apr 2009 02:43:12 +0000
parents
children 1f139de929c4
comparison
equal deleted inserted replaced
0:900ba3c7b765 1:dbd703f7d63a
1 """Forms for the Polls application."""
2
3 from django import forms
4
5 from polls.models import Choice
6
7
8 class VoteForm(forms.Form):
9 """Form for voting in a poll."""
10 choices = forms.ModelChoiceField(label='', empty_label=None,
11 queryset=Choice.objects.none(), widget=forms.RadioSelect)
12
13 def __init__(self, poll, *args, **kwargs):
14 super(VoteForm, self).__init__(*args, **kwargs)
15 self.fields['choices'].queryset = poll.choice_set.all()
16