On Mar 26, 10:08 am, Emanuel <[email protected]> wrote: > Hi! > > I Have this model: > class Person(models.Model): > user = models.ForeignKey(User) > nr = models.IntegerField(blank=True,) > gender = models.CharField(max_length=1, blank=True, > choices=gender_choices) > > def __unicode__(self): > return self.user.get_full_name() > .... > > I'm using a modelForm of this form. > > I have another model: > class Couple(models.Model): > season = models.ForeignKey(season) > man = models.ForeignKey(Person, related_name='man',) > woman = models.ForeignKey(Person, related_name='woman',) > .... > > And I'm also using a modelForm of this one. > > In the template I have a combobox for the man and for the woman wich shows > the __unicode__ method of Person model, but it shows both women and men in > both combo's. > I want to filter only men or women depending the case. Is it possible? Or > should I create another method for independent cases? If it is the solution > how can I use it? I'm not getting there because it is a instance of a class... > > Thanks > Emanuel
Nothing to do with __unicode__. You want limit_choices_to. http://docs.djangoproject.com/en/1.1/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to -- DR. -- 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.

