{"id":6378,"date":"2023-01-12T02:40:29","date_gmt":"2023-01-12T02:40:29","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=6378"},"modified":"2023-01-12T04:22:03","modified_gmt":"2023-01-12T04:22:03","slug":"django-orm-like","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/django-tutorial\/django-orm-like\/","title":{"rendered":"Django LIKE"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to query data using based on pattern matching in Django  which is equivalent to the <code>LIKE<\/code> operator.<\/p>\n\n\n\n<p>We&#8217;ll use the <code>Employee<\/code> models from the HR application for the demonstration. The <code>Employee<\/code> model maps to the <code>hr_employee<\/code> table in the database:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"211\" height=\"211\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2023\/01\/django_orm_employee_table.png\" alt=\"\" class=\"wp-image-6379\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2023\/01\/django_orm_employee_table.png 211w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2023\/01\/django_orm_employee_table-150x150.png 150w\" sizes=\"auto, (max-width: 211px) 100vw, 211px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id='startswith-and-istartswith'>startswith and istartswith <a href=\"#startswith-and-istartswith\" class=\"anchor\" id=\"startswith-and-istartswith\" title=\"Anchor for startswith and istartswith\">#<\/a><\/h2>\n\n\n\n<p>Sometimes, you want to check if a string starts with a substring. For example, you may want to find employees whose first name starts with Je. <\/p>\n\n\n\n<p>To do that in SQL, you use the <code>LIKE<\/code> operator like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">SELECT * \nFROM hr_employee\nWHERE first_name LIKE <span class=\"hljs-string\">'Je%'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>%<\/code> is a wildcard that matches any number of characters. And the <code>'Je%'<\/code> matches the strings that start with <code>Je<\/code> and are followed by zero or more characters.<\/p>\n\n\n\n<p>To query data from Django using the <code>LIKE<\/code> operator, you use the <code>startswith<\/code> by appending it to a field name:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">field_name__startswith<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example, the following uses the <code>filter()<\/code> method to find employees whose first names start with <code>Je<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-meta\">&gt;&gt;&gt; <\/span>Employee.objects.filter(first_name__startswith=<span class=\"hljs-string\">'Je'<\/span>) \nSELECT <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"id\"<\/span>,        \n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"last_name\"<\/span>, \n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"contact_id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"department_id\"<\/span>\n  FROM <span class=\"hljs-string\">\"hr_employee\"<\/span>\n WHERE <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>::text LIKE <span class=\"hljs-string\">'Je%'<\/span>\n LIMIT <span class=\"hljs-number\">21<\/span>\nExecution time: <span class=\"hljs-number\">0.000998<\/span>s &#91;Database: default]\n&lt;QuerySet &#91;&lt;Employee: Jennifer Thompson&gt;, &lt;Employee: Jerry Cunningham&gt;, &lt;Employee: Jesus Reilly&gt;, &lt;Employee: Jessica Lewis&gt;, &lt;Employee: Jeanette Hendrix&gt;, &lt;Employee: Jeffrey Castro&gt;, &lt;Employee: Jessica Jackson&gt;, &lt;Employee: Jennifer Bender&gt;, &lt;Employee: Jennifer Moyer&gt;]&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If you want to find employees whose first names start with <code>Je<\/code> case-insensitively, you can use the <code>istartswith<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-meta\">&gt;&gt;&gt; <\/span>Employee.objects.filter(first_name__istartswith=<span class=\"hljs-string\">'je'<\/span>) \nSELECT <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"last_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"contact_id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"department_id\"<\/span>\n  FROM <span class=\"hljs-string\">\"hr_employee\"<\/span>\n WHERE UPPER(<span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>::text) LIKE UPPER(<span class=\"hljs-string\">'je%'<\/span>)\n LIMIT <span class=\"hljs-number\">21<\/span>\nExecution time: <span class=\"hljs-number\">0.001398<\/span>s &#91;Database: default]\n&lt;QuerySet &#91;&lt;Employee: Jennifer Thompson&gt;, &lt;Employee: Jerry Cunningham&gt;, &lt;Employee: Jesus Reilly&gt;, &lt;Employee: Jessica Lewis&gt;, &lt;Employee: Jeanette Hendrix&gt;, &lt;Employee: Jeffrey Castro&gt;, &lt;Employee: Jessica Jackson&gt;, &lt;Employee: Jennifer Bender&gt;, &lt;Employee: Jennifer Moyer&gt;]&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this case,  the <code>__istartswith<\/code> uses the uppercase version of the value for matching.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='endswith-and-iendswith'>endswith and iendswith <a href=\"#endswith-and-iendswith\" class=\"anchor\" id=\"endswith-and-iendswith\" title=\"Anchor for endswith and iendswith\">#<\/a><\/h2>\n\n\n\n<p>The <code>endswith<\/code> and <code>iendswith<\/code> return True if a value ends with a substring. The <code>endswith<\/code> is equivalent to the following <code>LIKE<\/code> operator:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">LIKE <span class=\"hljs-string\">'%substring'<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example, the following uses the <code>endswith<\/code> to find employees whose first names end with <code>er<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-meta\">&gt;&gt;&gt; <\/span>Employee.objects.filter(first_name__endswith=<span class=\"hljs-string\">'er'<\/span>)           \nSELECT <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"last_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"contact_id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"department_id\"<\/span>\n  FROM <span class=\"hljs-string\">\"hr_employee\"<\/span>\n WHERE <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>::text LIKE <span class=\"hljs-string\">'%er'<\/span>\n LIMIT <span class=\"hljs-number\">21<\/span>\nExecution time: <span class=\"hljs-number\">0.000999<\/span>s &#91;Database: default]\n&lt;QuerySet &#91;&lt;Employee: Jennifer Thompson&gt;, &lt;Employee: Tyler Briggs&gt;, &lt;Employee: Spencer Riggs&gt;, &lt;Employee: Roger Robinson&gt;, &lt;Employee: Hunter Boyd&gt;, &lt;Employee: Amber Brown&gt;, &lt;Employee: Tyler Coleman&gt;, &lt;Employee: Jennifer Bender&gt;, &lt;Employee: Jennifer Moyer&gt;]&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>It returns the employees with the first names <code>Jennifer<\/code>, <code>Tyler<\/code>, <code>Spencer<\/code>, <code>Roger<\/code>, etc.<\/p>\n\n\n\n<p>The <code>iendswith<\/code> is the case-insensitive version of the <code>endswith<\/code>. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-meta\">&gt;&gt;&gt; <\/span>Employee.objects.filter(first_name__iendswith=<span class=\"hljs-string\">'ER'<\/span>) \nSELECT <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"last_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"contact_id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"department_id\"<\/span>\n  FROM <span class=\"hljs-string\">\"hr_employee\"<\/span>\n WHERE UPPER(<span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>::text) LIKE UPPER(<span class=\"hljs-string\">'%ER'<\/span>)\n LIMIT <span class=\"hljs-number\">21<\/span>\nExecution time: <span class=\"hljs-number\">0.000999<\/span>s &#91;Database: default]\n&lt;QuerySet &#91;&lt;Employee: Jennifer Thompson&gt;, &lt;Employee: Tyler Briggs&gt;, &lt;Employee: Spencer Riggs&gt;, &lt;Employee: Roger Robinson&gt;, &lt;Employee: Hunter Boyd&gt;, &lt;Employee: Amber Brown&gt;, &lt;Employee: Tyler Coleman&gt;, &lt;Employee: Jennifer Bender&gt;, &lt;Employee: Jennifer Moyer&gt;]&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='contains-and-icontains'>contains and icontains <a href=\"#contains-and-icontains\" class=\"anchor\" id=\"contains-and-icontains\" title=\"Anchor for contains and icontains\">#<\/a><\/h2>\n\n\n\n<p>The <code>contains<\/code> allows you to check if a string contains a substring. It is equivalent to the following <code>LIKE<\/code> operator:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">LIKE <span class=\"hljs-string\">'%substring%'<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example, the following finds the employees whose first name contains the substring <code>ff<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-meta\">&gt;&gt;&gt; <\/span>Employee.objects.filter(first_name__contains=<span class=\"hljs-string\">'ff'<\/span>)  \nSELECT <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"last_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"contact_id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"department_id\"<\/span>\n  FROM <span class=\"hljs-string\">\"hr_employee\"<\/span>\n WHERE <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>::text LIKE <span class=\"hljs-string\">'%ff%'<\/span>\n LIMIT <span class=\"hljs-number\">21<\/span>\nExecution time: <span class=\"hljs-number\">0.001293<\/span>s &#91;Database: default]\n&lt;QuerySet &#91;&lt;Employee: Tiffany Jackson&gt;, &lt;Employee: Tiffany Holt&gt;, &lt;Employee: Jeffrey Castro&gt;]&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The query returns the employees with the first names Tiffany and Jeffrey.<\/p>\n\n\n\n<p>The <code>icontains<\/code> is the case-insensitive version of the <code>contains<\/code>. So you can use the <code>icontains<\/code> to check if a string contains a substring case-insensitively:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-meta\">&gt;&gt;&gt; <\/span>Employee.objects.filter(first_name__icontains=<span class=\"hljs-string\">'ff'<\/span>) \nSELECT <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"last_name\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"contact_id\"<\/span>,\n       <span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"department_id\"<\/span>\n  FROM <span class=\"hljs-string\">\"hr_employee\"<\/span>\n WHERE UPPER(<span class=\"hljs-string\">\"hr_employee\"<\/span>.<span class=\"hljs-string\">\"first_name\"<\/span>::text) LIKE UPPER(<span class=\"hljs-string\">'%ff%'<\/span>)\n LIMIT <span class=\"hljs-number\">21<\/span>\nExecution time: <span class=\"hljs-number\">0.002012<\/span>s &#91;Database: default]\n&lt;QuerySet &#91;&lt;Employee: Tiffany Jackson&gt;, &lt;Employee: Tiffany Holt&gt;, &lt;Employee: Jeffrey Castro&gt;]&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Django<\/th><th>SQL LIKE<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td><code>field_name__startswith='substring'<\/code><\/td><td><code>field_name LIKE  '%substring'<\/code><\/td><td>return True if <code>field_name<\/code> starts with a substring.<\/td><\/tr><tr><td><code>field_name__istartswith='substring'<\/code><\/td><td><code>UPPER(field_name) LIKE  UPPER('%substring')<\/code><\/td><td>return True if <code>field_name<\/code> starts with a substring case-insensitively<\/td><\/tr><tr><td><code>field_name__endswith='substring'<\/code><\/td><td><code>field_name LIKE  'substring%'<\/code><\/td><td>return True if <code>field_name<\/code> ends with a substring.<\/td><\/tr><tr><td><code>field_name__iendswith='substring'<\/code><\/td><td><code>UPPER(field_name) LIKE  UPPER('substring%')<\/code><\/td><td>return True if <code>field_name<\/code> ends with a substring case-insensitively<\/td><\/tr><tr><td><code>field_name__contains='substring'<\/code><\/td><td><code>field_name LIKE  '%substring%'<\/code><\/td><td>return True if <code>field_name<\/code> contains a substring.<\/td><\/tr><tr><td><code>field_name__icontains='substring'<\/code><\/td><td><code>UPPER(field_name) LIKE  UPPER('%substring%')<\/code><\/td><td>return True if <code>field_name<\/code> contains a substring case insensitively.<\/td><\/tr><\/tbody><\/table><\/figure>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"6378\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/django-tutorial\/django-orm-like\/\"\n\t\t\t\tdata-post-title=\"Django LIKE\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"6378\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/django-tutorial\/django-orm-like\/\"\n\t\t\t\tdata-post-title=\"Django LIKE\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to query data using based on pattern matching which is equivalent to the LIKE operator.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":5531,"menu_order":31,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6378","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/6378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/comments?post=6378"}],"version-history":[{"count":0,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/6378\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/5531"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=6378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}