Hi,

i'm trying to limit what the user sees for a certain Foreign key.
I was told to use the limited_choices_to argument and it indeed seems
to fit the bill. However, i'm doing something wrong as this is what i get:

TypeError at /patient/edit/94/
_filter_or_exclude() argument after ** must be a dictionary

This is the relevant code from my models.py
def get_rooms():
    return Room.objects.exclude(id__in=[patient.room.id for patient in
Patient.objects.filter(room__isnull=False)])

class Patient(models.Model):
    room = models.ForeignKey(Room, blank=True, null=True,
limit_choices_to = get_rooms )

I tried limit_choices_to = {'id_in': get_rooms} but this gives me:
TypeError at /patient/aanpassen/94/
Cannot resolve keyword 'id_in' into field

limit_choices_to = {'id': get_rooms}

So how can i specify my limited choices?

Thanks


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