On Tue, 2009-03-03 at 20:01 -0800, mediumgrade wrote:
> I am planning to create a series of widgets for Dojo. I just need a
> little help getting started:
> 
> First, I need to know how to set custom attributes in a widget. The
> most important thing to set is "dojoType." For most widgets, I plan to
> use the TextInput widget as my base.


The "attrs" parameter is passed to the widget's constructor. It's a
dictionary.

> 
> Secondly, I would like to know how I can set the "Select" widget to
> NOT display the "--------" placeholder for the empty option. Dojo has
> it's own way of handling this. Can I access the "required"  attribute
> from a widget? Can I simply "pop" this option off the "choices" list?

Modifying any data structure in place would be risky, since it's quite
probably being shared by reference. However, replacing it with a new
data structure that meets your needs (so copying and then modifying)
should work.

Realise that the list of choices is often generated dynamically (e.g. if
you're taking a list of foreign key references). So you'll need to
investigate on a case-by-case basis. The relevant source is in
django/forms/fields.py (and other django/forms/* files) and
django/db/models/fields/__init__.py

Regards,
Malcolm



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