Reputation: 1
I am trying to return all the rows with BooleanField equal true
or false
.
I am using python django, the field name and field value store in dict:
books = Book.objects.filter(**book_dict).prefetch_related(prefetch).select_related(
'book_pdf',
'book__pdf_file').distinct('id')
The dict contains: {'fieldName__in': 'False'}
and the actual query it always 'select ... where fieldName in (True)'
I tryed to change the dict to: {'fieldName__in': 'false'}
and got the same result, and also change to:{'fieldName__in': False}
and got error: "bool is not iterable"
Upvotes: 0
Views: 45
Reputation: 599580
I don't understand why you're using __in
, or why you're using a string for the value. It should just be: {'fieldname': False}
with no quotes.
Upvotes: 4