Am Freitag, 3. August 2007 00:19 schrieb rskm1:
> Newforms has a spiffy way to dynamically set the "initial" values of
> fields, in the view code when the Form is constructed.
>   choosecolorform = ChooseColorForm(initial={'color': 'black'})

I think you only can set initial to a value, not to a dict.


> I was hoping it would be just as easy to dynamically define the
> choices available in a ChoiceField, too... but no such luck.
>
> The choices in my ChoiceField will ultimately come from a database,
> and will vary based on user permissions and/or the state of the page
> that the form is being displayed on, etc.

By looking at the source I found the QueySetIterator:

  choices=forms.models.QuerySetIterator(User.objects.all(), "", False)


HTH,
 Thomas

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to