You can't limit choice like that. The choices specified there are
evaluated only when the model is first evaluated (module load time).

What you need to do is limit the options displayed to the user via
form choices assigned in your view.

So you might do something like this (I'm half asleep, but hopefully
you get the idea):

user=User.objects.get(pk=1)
EForm = form_for_model(example_model)
EForm.fields['apple'].choices= \
    [(a.id,a.name) for a in user.example_model_set.objects.all()]
form=EForm()

Although now that I look at your model, I'm not sure I get what you
are doing.  Something like this makes more sense unless I'm
misunderstanding:

Assuming an apple has a single owner....
class Apple(models.Model):
    owner=models.ForeignKey(User)
    apple_field1 = models.IntegerField()
    apple_field2 = models.IntegerField()

Assuming an apple has a multiple owners and owners have multiple
apples....
class Apple(models.Model):
    owner=models.ManyToManyField(User) # Let django make the
intermediate table for you
    apple_field1 = models.IntegerField()
    apple_field2 = models.IntegerField()


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