Using django need to return a query set where values should be IN variable p1 and p2 :
p1 = 's'
p2 = 't'
formset_OK=pocketTransactionFormset(queryset=Pockets.objects.filter(pocket_owner=request.user).extra(where=['pocket_name=%s'], params=[p1]))
the above code with formset_OK works but then it will result in only 1 value i.e. s , however i want to have values using IN Clause of SQL, so i tried below code but it dosent work and throws error no such column: s :
formset_NOTOK =pocketTransactionFormset(queryset=Pockets.objects.filter(pocket_owner=request.user).extra(where=['pocket_name IN (s,t)']))
Django documentation says that
Entry.objects.extra(where=['id IN (3, 4, 5, 20)'])
is equal to
SELECT * FROM blog_entry WHERE id IN (3, 4, 5, 20);
but seems this is not true when 3,4,5,6 are strings .
ANy advices how to make it work for strings :