How to use regular expressions in Django ORM? I’ve found __search and __contains field’s postfix, but __regexp dosn’t works.
The solution is to use __regex instead of __regexp if someone stuck with the same problem.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What do you mean it doesn’t work? What regular expression did you try and what happened? It should work just as it says in the docs:
https://docs.djangoproject.com/en/dev/ref/models/querysets/#regex
by simply putting your regex string in the query.