On Thu, Dec 24, 2009 at 5:24 PM, hotani <hot...@gmail.com> wrote:
> I have close to 600 users split by 20 or so offices. We have a
> helpdesk form (using ModelForm) which displays an initial user list
> based on the office, or no users if an office is not selected.
>
> An AJAX function on the front end dynamically changes users in the
> drop-down based on the office selection. An admin can change the
> office which will display a new set of users to choose from.
>
> Everything is fine till it comes to django validating the form. Since
> the user selection coming in for processing may not have been one of
> the initial choices, I keep getting the dreaded "That choice is not
> one of the available choices" error.
>
> I can hack this up by first sending all users to the field, then
> erasing and resetting the display on the front end but would like a
> more "standard" solution.
>
> Using clean_user(self) does not work - I can throw errors from there
> but don't seem to have a way to tell django "this value is OK,
> dammit!"
>

how about using int field for user with custom widget and own custom
clean() method which checks if selected user is in range based of
other (office department) field?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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