Monday, May 9, 2011

boolwan field filter

hello ..
i am having a database of college which have a name city state
branches etc...
so
class College(models.Model):
name = models.CharField(max_length=250)
city = models.ForeignKey(City)
branch1 = models.BooleanField(default=False, blank=True)
branch2 = models.BooleanField(default=False, blank=True)
branch3 = models.BooleanField(default=False, blank=True)
branch4 = models.BooleanField(default=False, blank=True)
now i want to provide user that they can search colleges from
branches..
so i am giving them a select box where they can select the city and
branches
suppose i get two queries c and b
so i will filter all the colleges having city = c and
Branches=b
so please tell me how to filter
i have filtered city but how to add one another filter for branch {as
it is bolleanfield}
college_list = College.objects.filter(city__title__icontains=Qcity)

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate