Hi,
I have a basic form question I have been struggling with.
I have a form with a set of radio options and I want to specify the
option values.
I got this to work. However, I was assigning the values external to
the form in the view. This form will be used in quite a few spots and
I would like to remove the redundancy of specifying the options in
each view i use the form.
import django.newforms as forms
from django.newforms.widgets import *
class StorySubmitForm(forms.Form):
'''Assume Base Fields Are fine'''
class BookmarkSubmitForm(StorySubmitForm):
VOTING_CHOICES = [('1','Public'), ('-1','Private'), ('0','Personal')]
publish = forms.BooleanField()
access_control = forms.fields.CharField(max_length=255)
BookmarkSubmitForm.base_fields['access_control'].widget =
RadioSelect(choices = VOTING_CHOICES)
The very last line is the one that doesn't work. Says
BookmarkSubmitForm is not defined. This makes sense, but I have no
idea how idea to assign this. I tried self which is undefined, etc.
Any help would be appreciated.
Thanks,
Blaine
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---