Hello, The widget kw can be either a class or an instance. You can do xField(widget=xWidget(choices=mychoices)) Or you can create your xField with your xWidget as default widget and let the field to accept the choices kw.
Matias. On Fri, Dec 12, 2008 at 8:44 AM, commander_coder < commander_co...@hotmail.com> wrote: > > How does a field pass attributes to a widget? I have approximately > this > > class fooForm(forms.Form): > x_choice=myForms.xField(widget=myWidgets.xWidget) > > where myWidgets.xWidget is a subclass of RadioSelect so it has a > required argument like "choices=[('a','1'), ('b','a')]" (this is > generated dynamically so I can't build it in to xWidget). Where in > the Django code base does that information get passed? > > The examples I've studied don't seem to me to show xField being > written to pass it explicitly but they do make a super() call, so I > expect it is done there. I see in the render code for the widget > references to the variable self.choices, so it is getting remembered > by the widget in that way. However, I've struggled with the Django > source and I can't make out how it is passed. I'd be very grateful if > someone could help me find it. > > Jim > > > -- :wq --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---