You could have the autocomplete opperate on a dummy_seat input, and
have the js fill in the correct user id in a hidden 'seat' field on
blur.

Maybe even nicer, a selectbox containing all users, and an input that
pops up on focus to filter. That way the form degrades nicely when js
is turned off. Makes a big selectbox though...

just my 2p



On Jun 26, 8:40 pm, Greg Taylor <[EMAIL PROTECTED]> wrote:
> I've got a model that represents a boat of rowers which has eight
> seats (order is important). The easiest way to handle this was a model
> with eight foreign keys:
>
> class Boat(models.Model):
>   seat_1 = models.ForeignKey(User)
>   [...]
>   seat_8 = models.ForeignKey(User)
>
> Which is fine and great, but now in the user-space boat editing page,
> we have to go through a large list of usernames for each seat to find
> the person we're looking for. The site refers to everyone by their
> full names, usernames are only used for logging in, so we need to be
> able to filter or auto-complete based on first/last name (which is not
> a problem).
>
> Does anyone know of a good way to let them quickly search by name and
> set these seats without having to navigate away from the page? Any
> AJAX utilities to recommend? I looked at YUI auto-complete, but that
> might get tricky since ForeignKey expects an integer in this case
> (id=int). It's very easy to set up auto-complete, but I'm not sure of
> the best way to have it set the Int.
>
> Any ideas?
--~--~---------~--~----~------------~-------~--~----~
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