RESPONDANT_CHOICES = (
('Excellent', 'Excellent'),
('Good', 'Good'),
('Poor', 'Poor'),
)
class Respondant(models.Model):
key = models.CharField(max_length=8, blank=True, null=True, unique=True)
create_date = models.DateTimeField('date created', auto_now_add=True)
name = models.CharField(max_length=100, blank=True, help_text='*Field 0ptional')
title = models.CharField(max_length=100, blank=True, help_text='*Field 0ptional')
unit = models.CharField(max_length=100, choices=UNITS, blank=True, help_text='*Field 0ptional')
email = models.EmailField(max_length=100,
help_text='*Field 0ptional',
unique=False, blank=True)
event = models.ForeignKey(Event, limit_choices_to = {'survey_open_flag': True},)
question_1 = models.CharField(max_length=100, choices=RESPONDANT_CHOICES)
question_2 = models.CharField(max_length=100, choices=RESPONDANT_CHOICES)
question_3 = models.CharField(max_length=100, choices=RESPONDANT_CHOICES)
question_4 = models.CharField(max_length=100, choices=RESPONDANT_CHOICES)
question_5 = models.CharField(max_length=100, choices=RESPONDANT_CHOICES)
comment_6 = models.TextField('')
comment_7 = models.TextField('?')
comment_8 = models.TextField('')
comment_9 = models.TextField('')
comment_10 = models.TextField('')
forms.py
from django import forms
from models import Respondant, Event, RESPONDANT_FIELDS, RESPONDANT_CHOICES
class RespondantForm(forms.ModelForm):
question_1 = forms.CharField(label='',widget=forms.RadioSelect(choices=RESPONDANT_CHOICES), required=True)
question_2 = forms.CharField(label='',widget=forms.RadioSelect(choices=RESPONDANT_CHOICES), required=True)
question_3 = forms.CharField(label='',widget=forms.RadioSelect(choices=RESPONDANT_CHOICES), required=True)
question_4 = forms.CharField(label='',widget=forms.RadioSelect(choices=RESPONDANT_CHOICES), required=True)
question_5 = forms.CharField(label='',widget=forms.RadioSelect(choices=RESPONDANT_CHOICES), required=True)
class Meta:
model = Respondant
fields = RESPONDANT_FIELDS
On Mon, Aug 2, 2010 at 9:53 AM, Daniel Roseman <daniel@roseman.org.uk> wrote:
On Aug 2, 2:46 pm, rupert <evan.fer...@gmail.com> wrote:
> I have a form that validates all of the fields except for radio
> buttons. If there is a radio button not selected, it will reset the
> form. Any thoughts? Has anyone run into this before?
Show some code...
--
DR.
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
Evan Ferree
P.O. Box 36151
Indianapolis, Indiana 46236
m| 812.620.3152
http://www.evanferree.com
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment