1👍
✅
You can see how to make a dynamic OR’d together query at How to dynamically compose an OR query filter in Django?.
Do you need to do it this way, though? Case-insensitive regex queries are quite slow.
Are you using PostgreSQL for your data store? If so, you could investigate the full-text indexing capabilities. That would give you a much faster way to perform these kinds of searchers.
Source:stackexchange.com