Hi,

my app is used to manage patients of a ward in a hospital.
This ward has a number of beds available.
A patient has a room id referring to the room/bed where he's laying.

Now i would want to avoid being able to select a bed that is already in use.
I thought of using my own validator.
So ideally i would like to keep all fields and just change the room
field instead of defining them all.

I didn't find a clear way of only changing one field without
specifying them all.
I hacked it by first looking up the index of the field in the fields list
and replacing it with my own version:
fields[index] = forms.SelectField(field_name="room", choices =
room_choices, validator_list=[room_validator])

room_choices is simply a list of all the rooms and room_validator is
my room validator.
The problem i'm having with this approach is that the current room
isn't preselected in the dropdown list when i change the patient data.
Could be expected when you make your own.

How can i specify a selected room in forms.SelectField or is there
another way to make sure a user can't assign a bed that is already in
use?

Thanks,
Benedict

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