Hi,

how does your view looks like?
why you're unable to set initial data for the form?

Radovan


firebug wrote:
> 
> 
> Hi,
> 
> I want to limit the choice of ChoiceField to a predefined value, if
> the value from POST does not exist in given choices. How this could be
> done easily? I don't want to modify the POST-dictionary before it is
> passed to the form instance, because I would have to write same code
> all over the place.
> 
> The form is used to select week range, and data from that week range
> is shown on a chart. The view is always called using AJAX and POST, so
> I can't set initial value (they are overwritten because of POST data).
> If user does not give a correct week range, the default range should
> be selected.
> 
> 
> I tried to write my own LimitedChoiceField class, and here is the
> result: http://paste.servut.us/3a67 . Clean value is returned
> correctly, but it won't affect the selected value of the form at all.
> 
> Any help would be appreciated!
> 
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Limiting-the-choice-of-ChoiceField-if-not-in-choices-tp24410282p24422060.html
Sent from the django-users mailing list archive at Nabble.com.


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

Reply via email to