Suppose I have a model class that has a foreign key field, something like the following:
class example_model(models.Model): apple = models.ForeignKey(Apple) owner = models.ForeignKey(User) where Apple is created by authenticated users. So at any given time, there may be multiple Apples created by different users. When I create a form via form_for_model(example_model), however, all possible Apples created by different users will be visible. My question is how do I limit the Apple choices in the form to only show the Apples the the current user created? I tried to do apple = models.ForeignKey(Apple, limit_choices_to={'owner__exact': self.owner}), But django says 'self' is not defined . Can anyone tell me what I should do? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---