Hello Django Users!

I am trying to implement a form that uses the Radio select widget so
users can choose from 5 available choices. Does anyone know how I can
implement this using ModelForm? I have provided code snippets at the
bottom, and the choices are in models.py (RESPONDANT_CHOICES = ('Very
Satisfied', 'Satisfied', 'Neutral', 'Dissatisfied', 'Very
Dissatisfied',))

Thank you for any help!
EF

----------------------
I have the following code:

#forms.py
from django import forms
from models import Respondant, RESPONDANT_FIELDS, RESPONDANT_CHOICES

class RespondantForm(forms.ModelForm):
        class Meta:
                model = Respondant
                fields = RESPONDANT_FIELDS

#models.py
from django.db import models
from django.contrib.localflavor.us.models import PhoneNumberField
from django.template.defaultfilters import slugify
from datetime import datetime, timedelta
import hashlib

RESPONDANT_CHOICES = ('Very Satisfied', 'Satisfied', 'Neutral',
'Dissatisfied', 'Very Dissatisfied',)

RESPONDANT_FIELDS = ('name', 'title', 'question_1', 'question_2',)

class Respondant(models.Model):
        key = models.CharField(max_length=32, blank=True, null=True,
unique=True)
        create_date = models.DateTimeField('date created', auto_now_add=True)

        name = models.CharField(max_length=100)
        title = models.CharField(max_length=100)

        question_1 = models.CharField(max_length=100)
        question_2 = models.CharField(max_length=100)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to