On Feb 13, 8:06 am, Benedict Verheyen <[EMAIL PROTECTED]>
wrote:
> def get_rooms():
> return Room.objects.exclude(id__in=[patient.room.id for patient in
> Patient.objects.filter(room__isnull=False)])
> 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?
I think you need to pass the actual values (i.e. the rooms), rather
than a function that returns them. Also 'id_in' needs two
underscores. So maybe:
limit_choices_to = {'id__in': get_rooms()}
Scott
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---