I have the following filter query that executes an SQL OR statement:
results = Stores.objects.filter(Q(title__icontains=prefs.address1) | Q(title__icontains=prefs.address2))
This works fine, but if the values ββof prefs.address1 and prefs.address2 (which come from another model) are empty in mySQL, Django complains about the following error:
Cannot use None as request value
Is there an elegant way to check if filter values ββare cleared before creating an OR filter request?
Many thanks.
python django
givp
source share