3👍
XYZ.objects\
.annotate(querystring=Value('ABCDEFG', output_field=CharField()))\
.filter(querystring__icontains=F('column1'))
My team mate found this one. It works for me.
Under the hood it gives the same SQL as topic starter mentioned above.
1👍
You can use Q objects.
XYZ.objects.filter(Q(('{}__contains'.format("ABCDEFG"), "column1")))
- [Django]-How do I properly configure my app to use the Django phonenumber field module?
- [Django]-"Not a valid string." – error when trying save dict to TextField in Django Rest Framework
- [Django]-Modifying ancestor nested Meta class in descendant
- [Django]-Can't change Django admin template
- [Django]-<title> {% block title %} Home {% endblock %} </title> is not override by other page?
Source:stackexchange.com