Tuesday, October 29, 2013

filter from databse list

Hi,

   I'm using chcekboxes for 3 location india,china,usa in my form. The selected filed are stoiring in database in list like:  location: ['india','china', 'usa']


1st row in databse:  ['india']
2nd row in databse:  ['india', 'china']
3rd row in databse:  ['india', 'china', 'usa']


in my views.py file:
 
  faculty_list = serializers.serialize("json", camp_faculty.objects.all().filter(location=location_param))

  By calling API:
     
        HTTP://localhost:8000/fetchform/<location_param>

       The above API returning only data where location=india

  But If i pass location_param='india' I want all the all the three rows from database. How can i achieve this?

 Pls let me know the solution.


Thanks
mahantesh




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f738edb9-db4a-44c8-8e04-ec53d7b72ee7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment