Sorry, I guess I did not explain too well. What I am asking has to do with list_filter = ('affiliation', 'publication', 'research',) in the admin.
This displays a list on the right hand side of the admin. If I have Tom in school 'A', and Diane in school 'B'. I can filter on affiliation on 'A', and get Tom. I can filter on affiliation on 'B' and get Diane. Is there a way to select both 'A' and 'B' under affiliation and get both Tom and Diane? Thanks, sanrio On Feb 3, 4:17 pm, [EMAIL PROTECTED] wrote: > Hi, > > How do I hook that into the Admin? This is what I don't know. > > Thanks, > sanrio > > On Feb 3, 4:09 pm, William Siegrist <[EMAIL PROTECTED]> wrote: > > > Have you tried using the IN filter? > > > Student.objects.filter(school__in = [A, B]) > > >http://www.djangoproject.com/documentation/db-api/#in > > > -Bill > > > On Feb 3, 2008, at 1:41 PM, [EMAIL PROTECTED] wrote: > > > > Hi, > > > > I have a situation whereby I need to use filters with "OR" . > > > > Here is a description of my model: > > > > 1) A student affiliated to only one school. (ForeignKey) > > > 2) A student can only have one publication. (ForeignKey) > > > 3) A student can have multiple research interest(s). (ManytoManyField) > > > > I want to use the filter (which is awesome!!). However, I want to > > > filter > > > all students belonging to school A OR school B (with other filter > > > criteria, > > > on other columns (all ANDed). > > > > Can I do that with the django Admin? If so, how? > > > > Below is the actual model of my classes: > > > > I appreciate any help. > > > > Thanks, > > > sanrio > > > > class School (models.Model): > > > name = models.CharField (maxlength=60) > > > def __str__ (self): > > > return self.name > > > class Admin: > > > list_display = ('name',) > > > class Meta: > > > db_table = 'School' > > > > Publication (models.Model): > > > name = models.CharField (maxlength=50) > > > def __str__ (self): > > > return self.name > > > class Admin: > > > list_display = ('name',) > > > class Meta: > > > db_table = 'Publication' > > > > class Student (models.Model): > > > first_name = models.CharField (maxlength=30) > > > last_name = models.CharField (maxlength=30) > > > email = models.EmailField () > > > phone = models.PhoneNumberField () > > > research = models.ManyToManyField (Research, null=True, > > > blank=True) > > > publication = models.ForeignKey (Publication) > > > affiliation = models.ForeignKey (School) > > > > class Admin: > > > list_display = ('last_name', 'first_name', 'affiliatiation') > > > list_filter = ('affiliation', 'publication', 'research') > > > smime.p7s > > 3KDownload --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---