I'm not quite sure if this is helpful - it's not a general solution on the ForeignKey specification so wouldn't work in admin, for example, but it worked for me with my own form...
I was creating a view for a 'change' form. One parameter passed to the view (from the URL) was an organisation identifier. I wanted to restrict the choices in a ForeignKey form field to those which were relevant to that organisation. This seemed to work: def myobject_edit(request, org_id, obj_id): org = get_object_or_404(Organisation, pk=org_id) manip = Display.ChangeManipulator(obj_id) manip['otherobj'].choices = [ (e['id'], e['name']) for e in OtherObj.objects.filter(org__exact=org).values() ] ... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---