view gpp/polls/forms.py @ 330:3c951521e0ec

Fixing #152; POTD was saving thumbnail every night and making tons of thumbnail directories all over. Also added thumbnail images in the admin.
author Brian Neal <bgneal@gmail.com>
date Thu, 24 Feb 2011 03:45:50 +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()