On 7/4/07, Blaine Garrett <[EMAIL PROTECTED]> wrote:
>
> 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.

'self' won't be defined until there is an instance that can act as
'self'. As written, the widget assignment code you are trying to write
would need to be in the __init__ method, so that each form instance
sets the widget when it is constructed.

However, the better approach is to define the widget at the same time
you define the field:

      access_control = forms.fields.CharField(max_length=255, \
                  widget=RadioSelect(choices=VOTING_CHOICES))

CharFields will default to a text entry widget, but you can use the
widget argument instruct the field to use any widget you want, using
either an instance (as in this case), or a class of widget.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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