{"id":306656,"date":"2020-07-09T03:00:13","date_gmt":"2020-07-09T03:00:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=306656"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=306656","title":{"rendered":"\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 django filter \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0435\u043c\u043e \u0431\u0430\u0437\u044b PostgreSQL"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/510196\/\">\n<h1 id=\"vmesto-predisloviya\">\u0412\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u044f<\/h1>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430 &quot;\u041e\u0441\u043d\u043e\u0432\u044b \u0432\u0435\u0431-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f&quot; \u043f\u043e\u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u044b\u0432\u0430\u043d\u0438\u044f \u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442 \u0438 \u043a\u0443\u0440\u0441\u043e\u0432\u043e\u0439, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044f \u0437\u0430\u044f\u0432\u0438\u043b \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0445\u043e\u0442\u0435\u043b \u0431\u044b\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043e\u0442\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435 \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u043a\u0443\u0440\u0441\u0430 (\u0438 \u0442\u0430\u043a \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u043d\u0438\u0439 \u0431\u044b\u043b\u043e \u043f\u043e \u0441\u0432\u044f\u0437\u043a\u0435 DRF + Vue, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e). \u0418 \u0432\u043e\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 PR \u043d\u0430 github \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a (\u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u043c\u0435\u043a\u0430\u043b\u043e \u043d\u0430 \u044d\u0442\u043e) \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430, \u0447\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u043c\u0435\u043d\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/docs.djangoproject.com\/en\/3.0\/topics\/db\/search\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Django<\/a> \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043b\u0443\u0447\u0448\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c. \u0414\u0443\u043c\u0430\u044e, \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u0442\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0447\u0442\u043e \u0431\u044b\u043b\u0438 \u0442\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u044b (contains, icontains, trigram_similar). \u0412\u0441\u0435 \u043e\u043d\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u043d\u043e \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0445\u043e\u0440\u043e\u0448\u0438 \u0432, \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u043e\u0438\u0441\u043a\u0435. \u041f\u0440\u043e\u043b\u0438\u0441\u0442\u0430\u0432 \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435, \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 Django \u0438 Pgsql \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 document-based \u043f\u043e\u0438\u0441\u043a\u0430, \u0447\u0442\u043e \u043c\u0435\u043d\u044f \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u043b\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u043f\u043e\u0441\u0442\u0433\u0440\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0441\u0430\u043c\u043e\u0433\u043e [\u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e] \u043f\u043e\u0438\u0441\u043a\u0430. \u0418 \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, django \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 API \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0438\u0441\u043a\u0443, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0447\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0442\u043e\u0447\u043d\u0435\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u043b\u044e\u0431\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b. \u041f\u0440\u0435\u043f\u043e\u0434\u0430\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043d\u0435 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u043e\u0432\u0435\u0440\u0438\u043b, \u043c\u044b \u0441 \u043d\u0438\u043c \u043f\u043e\u0441\u043f\u043e\u0440\u0438\u043b\u0438, \u0438 \u043e\u043d \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443. \u0418 \u0432\u043e\u0442 \u044f \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"nachalo-raboty\">\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b<\/h2>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0435\u0440\u0435\u0434\u043e \u043c\u043d\u043e\u0439 \u0432\u0441\u0442\u0430\u043b\u0430 \u2014 \u043f\u043e\u0438\u0441\u043a \u043c\u043e\u043a\u0430\u043f\u0430 \u0411\u0414, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0445-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0445 \u0448\u0442\u0443\u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438 \u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0433\u0443\u0433\u043b\u0438\u0442\u044c \u0438 \u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/wiki.postgresql.org\/wiki\/Sample_Databases\">\u0432\u0438\u043a\u0438 \u043f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u0430<\/a>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043d\u0430 \u0438\u0445 <a href=\"https:\/\/postgrespro.com\/education\/demodb\">\u0434\u0435\u043c\u043e \u0431\u0430\u0437\u0435<\/a> \u043e \u043f\u043e\u043b\u0451\u0442\u0430\u0445 \u043f\u043e \u0420\u043e\u0441\u0441\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u0431\u0430\u0437\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 search \u0438\u0437 django.contrib.postgres.search. \u0412\u0442\u043e\u0440\u043e\u0435 \u2014 contains (\u0438\u0449\u0435\u0442 \u0441\u043b\u043e\u0432\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435) \u0438 icontains (\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044f \u0430\u043a\u0446\u0435\u043d\u0442\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 &quot;Helen&quot; \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: &lt;Author: Helen Mirren&gt;, &lt;Author: Helena Bonham Carter&gt;, &lt;Author: H\u00e9l\u00e8ne Joy&gt;), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0430\u043c django. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u044f \u0442\u0430\u043a \u0436\u0435 \u0445\u043e\u0447\u0443 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u0432\u043d\u0443\u0442\u0440\u0438 postgresql. \u0418\u0441\u043a\u0430\u0442\u044c \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 tickets \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 small \u043e\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 366733 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \u041f\u043e\u0438\u0441\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u043f\u043e\u043b\u044e passenger_name, \u0433\u0434\u0435, \u043a\u0430\u043a \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0438\u043c\u044f \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0430. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043e\u043d\u043e \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0442\u043e\u043c.<\/p>\n<p>  <\/p>\n<h2 id=\"dat-django-vozmozhnost-rabotat-s-uzhe-suschestvuyuschey-bd\">\u0414\u0430\u0442\u044c django \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0411\u0414<\/h2>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c django \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0411\u0414. \u041f\u043e\u043a\u043e\u043f\u0430\u0432\u0448\u0438\u0441\u044c \u0435\u0449\u0451 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 django \u044f \u043d\u0430\u0448\u0451\u043b \u043a\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c\u043a\u0438 \u043f\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0411\u0414, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0435\u0447\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0440\u0443\u0447\u043a\u0430\u043c\u0438 \u0432\u0441\u0451:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ python manage.py inspectdb &gt; models.py<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0441\u0430\u043c\u0430 \u0411\u0414 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0432 settings.py. \u0412\u0441\u0435\u0433\u043e \u043f\u0430\u0440\u0443 \u043e\u0448\u0438\u0431\u043e\u0447\u0435\u043a \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438 \u0432\u0441\u0451 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442. \u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0443\u044e \u0432\u044c\u044e\u0448\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c. \u0411\u0440\u0430\u0443\u0437\u0435\u0440, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u043f\u0440\u044f\u0433\u0441\u044f (\u0447\u0442\u043e \u0438 \u043d\u0435 \u043c\u0443\u0434\u0440\u0435\u043d\u043e), \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0430\u0434\u0440\u0435\u0441, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f 300\u043a+ \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b \u0438\u0445 \u0447\u0438\u0441\u043b\u043e \u0434\u043b\u044f 10, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0438 \u0442\u0430\u043c \u0445\u043e\u0442\u044f \u0431\u044b \u0435\u0441\u0442\u044c. \u0410 \u0432\u043e\u043e\u0431\u0449\u0435, \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u043b\u0443\u0447\u0448\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 curl. \u042d\u0442\u043e \u044f\u0432\u043d\u043e \u0441\u043a\u0443\u0448\u0430\u0435\u0442 \u0432 \u0440\u0430\u0437\u044b \u043c\u0435\u043d\u044c\u0448\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"vybor-metrik\">\u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u0442\u0440\u0438\u043a<\/h2>\n<p>  <\/p>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0432 \u043f\u0438\u0442\u043e\u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0430\u0439\u043c\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u043e\u0439 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0442\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0447\u0435\u0440\u0435\u0437 curl, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u0439\u0434\u0443\u0442 \u0434\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041a\u0440\u043e\u043c\u0435 \u044d\u0442\u043e\u0433\u043e, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0441 \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u044b\u043c (\u043f\u0440\u044f\u043c\u044b\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0411\u0414).<\/p>\n<p>  <\/p>\n<h2 id=\"filtruem-v-django\">\u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0432 django<\/h2>\n<p>  <\/p>\n<p>\u041d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044f \u0443\u0436\u0435 \u0441\u043d\u044f\u043b 600 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u2014 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0435\u0448\u0438\u043b \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u0430\u043b\u043e \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f view \u0434\u043b\u044f contains<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">class TicketListView(g.ListAPIView):     serializer_class = TicketSerializer      def get_queryset(self):                 queryset = ''         params = self.request.query_params          name = params.get('name', None)          if name:             start_time = d.datetime.now()              queryset = queryset.filter(passenger_name__contains=name)              end_time = d.datetime.now()              time_diff = (end_time - start_time)             execution_time = time_diff.total_seconds() * 1000              print(&quot;Filter execution time {} ms&quot;.format(execution_time))          return queryset<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h3>Contains<\/h3>\n<p>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441 contains, \u043f\u043e \u0441\u0443\u0442\u0438, \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a WHERE LIKE.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0417\u0430\u043f\u0440\u043e\u0441 \u0432 Django ORM\/\u0417\u0430\u043f\u0440\u043e\u0441 \u0432 sql \u0434\u043b\u044f contains<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">queryset = queryset.filter(passenger_name__contains=name)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"sql\">SELECT &quot;tickets&quot;.&quot;ticket_no&quot;, &quot;tickets&quot;.&quot;book_ref&quot;, &quot;tickets&quot;.&quot;passenger_id&quot;, &quot;tickets&quot;.&quot;passenger_name&quot;, &quot;tickets&quot;.&quot;contact_data&quot; FROM &quot;tickets&quot; WHERE &quot;tickets&quot;.&quot;passenger_name&quot;::text LIKE %IVAN%<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0437 curl \u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445):<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ curl -w &quot;%{time_total}\\n&quot; -o \/dev\/null -s http:\/\/127.0.0.1:8000\/api\/tickets\/?name=IVAN 1,242888<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0432\u0451\u043b \u0432\u0441\u0451 \u0432 <a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1KArNmPwCu4pcMLfEHaRk6C-OVecwEd9RIWA2exsjWNo\/edit?usp=sharing\">\u0442\u0430\u0431\u043b\u0438\u0446\u0435<\/a>, \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043b\u0438\u0441\u0442\u0435.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u0440\u0435\u0437\u044e\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u2014 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043e\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435, \u0438 \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0437\u0430\u0439\u043c\u0451\u0442 \u043e\u0442 140 \u0434\u043e 1400 \u043c\u0441. \u041d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e \u043d\u0430 \u0438\u0441\u0442\u0438\u043d\u0443, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0441\u0451 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a. \u0410 \u0432\u0440\u0435\u043c\u044f \u0441\u0430\u043c\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 ORM \u0437\u0430\u0439\u043c\u0451\u0442 \u043e\u0442 73 \u0434\u043e 600 \u043c\u0441, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u043e\u0442 55 \u0434\u043e 100 \u043c\u0441.<\/p>\n<p>  <\/p>\n<h3 id=\"icontains\">Icontains<\/h3>\n<p>  <\/p>\n<p>Icontains \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443 (\u043e\u043d \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0432\u0441\u0451 \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u0438\u043c). \u041a\u043e\u0434 \u0434\u043b\u044f \u0432\u044c\u044e\u0448\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u043e\u0447\u0442\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e contains \u2014 icontains. \u0412\u043e\u0442 \u0438 \u0432\u0441\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0417\u0430\u043f\u0440\u043e\u0441 \u0432 Django ORM\/\u0417\u0430\u043f\u0440\u043e\u0441 \u0432 sql \u0434\u043b\u044f icontains<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">queryset = queryset.filter(passenger_name__icontains=name)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"sql\">SELECT &quot;tickets&quot;.&quot;ticket_no&quot;, &quot;tickets&quot;.&quot;book_ref&quot;, &quot;tickets&quot;.&quot;passenger_id&quot;, &quot;tickets&quot;.&quot;passenger_name&quot;, &quot;tickets&quot;.&quot;contact_data&quot; FROM &quot;tickets&quot; WHERE UPPER(&quot;tickets&quot;.&quot;passenger_name&quot;::text) LIKE UPPER(%IVAN%)<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0443, \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0436\u0435 \u043c\u0435\u043d\u044c\u0448\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438 \u0441\u0430\u043c \u043f\u043e\u0441\u0442\u0433\u0440\u0435\u0441 \u043d\u0430\u0447\u0430\u043b \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043f\u043e\u0440\u044f\u0434\u043a\u0430 300 \u043c\u0441), \u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0437\u0430\u0439\u043c\u0451\u0442 \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043e\u0442 200 \u0434\u043e 1500 \u043c\u0441. \u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 ORM \u2014 \u043e\u0442 \u0434\u043e 200 \u0434\u043e 700 \u043c\u0441.<\/p>\n<p>  <\/p>\n<h3 id=\"full-text-search-cherez-djangocontribpostgres\">Full text search (\u0447\u0435\u0440\u0435\u0437 django.contrib.postgres)<\/h3>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u043d\u0435 \u0431\u044b\u043b\u043e, full text search \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u0449\u0443\u0442\u0438\u043c\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0448\u043b\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c. \u0412\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u043f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u0435 \u043a\u043e\u043b\u0435\u0431\u043b\u0435\u0442\u0441\u044f \u043e\u043a\u043e\u043b\u043e 1300 \u043c\u0441, \u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0442 1000 \u0434\u043e 1700 \u043c\u0441. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 ORM \u2014 \u0443\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u043e\u0442 1000 \u0434\u043e 1450 \u043c\u0441. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">class TicketListView(g.ListAPIView):     serializer_class = TicketSerializer      def get_queryset(self):         # queryset = Tickets.objects.all()         queryset = ''          params = self.request.query_params          name = params.get('name', None)          if name:              start_time = d.datetime.now()              queryset = Tickets.objects.filter(passenger_name__search=name)              end_time = d.datetime.now()              time_diff = (end_time - start_time)             execution_time = time_diff.total_seconds() * 1000              print(&quot;Filter execution time {} ms&quot;.format(execution_time))              f = open('results.txt', 'a')              f.write('{}'.format(execution_time))             f.write('\\n')              f.close()          return queryset<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h3 id=\"full-text-search-cherez-rest_frameworkfilters-tochnee-----searchfilter\">Full text search (\u0447\u0435\u0440\u0435\u0437 rest_framework.filters, \u0442\u043e\u0447\u043d\u0435\u0435 \u2014 SearchFilter)<\/h3>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0432\u043e\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e FTS, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0441\u0440\u0430\u0432\u043d\u0438\u043c\u044b\u043c\u0438 \u0441 FTS \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u043e\u0441\u0442\u0433\u0440\u0435, \u043d\u043e \u0445\u0443\u0436\u0435, \u0447\u0435\u043c contains \u0438 icontains. \u041e\u0442 200 \u0434\u043e 1710 \u043c\u0441.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c FTS \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442\u0441\u044f, \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443. \u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c, \u044d\u0442\u043e \u0437\u0430\u0439\u043c\u0451\u0442 \u043e\u0442 800 \u0434\u043e 1120 \u043c\u0441.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">... from rest_framework import filters as f  class TicketListView(g.ListAPIView):     queryset = Tickets.objects.all()     serializer_class = TicketSerializer     filter_backends = [f.SearchFilter]     search_fields = ['@passenger_name']<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h3 id=\"ispolzovanie-filtrov-cherez-modul-django-filter\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0443\u043b\u044c django-filter<\/h3>\n<p>  <\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0447\u0442\u0438 \u0441\u043e\u0432\u043f\u0430\u043b\u0438 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 contains \u0438 icontains, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043c\u044b\u0441\u043b\u0430 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u0432\u0438\u0436\u0443. \u0414\u0430 \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c, \u043c\u043e\u0434\u0443\u043b\u044c django-filter \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043e\u0449\u0443\u0442\u0438\u043c\u043e\u0433\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043f\u0435\u0440\u0435\u0434 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 Django ORM.<\/p>\n<p>  <\/p>\n<h2 id=\"tak-chto-v-itoge\">\u0422\u0430\u043a \u0447\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435?<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0451\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a (\u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0430\u0448\u0438\u043c \u0446\u0435\u043b\u044f\u043c) \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u0438 \u0441\u0447\u0430\u0441\u0442\u044c\u0435\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0440\u0435\u0448\u0430\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u043a\u0440\u0443\u0433 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041d\u043e \u0432\u043e\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u0438 \u0432 \u043d\u0451\u043c \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u2014 \u0443\u0436\u0435 \u0440\u0435\u0448\u0430\u0442\u044c \u0432\u0430\u043c. \u042f \u0443\u0441\u0432\u043e\u0438\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f, \u0447\u0442\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 (\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430, \u0430 \u0435\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e contains\/icontains) \u043b\u0443\u0447\u0448\u0435 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u043a\u0443\u0448\u0430\u0442\u044c \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0447\u0442\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e \u0441\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, \u043c\u043e\u0451 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b django \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e \u0443\u0441\u0442\u0430\u043a\u0430\u043d\u0438\u043b\u043e\u0441\u044c. \u0418 \u043f\u0440\u0438\u0448\u043b\u043e, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u043e \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0435 \u0438 \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c \u043f\u043e\u0438\u0441\u043a\u043e\u043c. \u0420\u0430\u0437\u043d\u0438\u0446\u0435 \u0432 \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 Django ORM.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/510196\/\"> https:\/\/habr.com\/ru\/post\/510196\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/510196\/\">\n<h1 id=\"vmesto-predisloviya\">\u0412\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u044f<\/h1>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430 &quot;\u041e\u0441\u043d\u043e\u0432\u044b \u0432\u0435\u0431-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f&quot; \u043f\u043e\u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u044b\u0432\u0430\u043d\u0438\u044f \u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442 \u0438 \u043a\u0443\u0440\u0441\u043e\u0432\u043e\u0439, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044f \u0437\u0430\u044f\u0432\u0438\u043b \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0445\u043e\u0442\u0435\u043b \u0431\u044b\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043e\u0442\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435 \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u043a\u0443\u0440\u0441\u0430 (\u0438 \u0442\u0430\u043a \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u043d\u0438\u0439 \u0431\u044b\u043b\u043e \u043f\u043e \u0441\u0432\u044f\u0437\u043a\u0435 DRF + Vue, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e). \u0418 \u0432\u043e\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 PR \u043d\u0430 github \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a (\u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u043c\u0435\u043a\u0430\u043b\u043e \u043d\u0430 \u044d\u0442\u043e) \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430, \u0447\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u043c\u0435\u043d\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/docs.djangoproject.com\/en\/3.0\/topics\/db\/search\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Django<\/a> \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043b\u0443\u0447\u0448\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c. \u0414\u0443\u043c\u0430\u044e, \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u0442\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0447\u0442\u043e \u0431\u044b\u043b\u0438 \u0442\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u044b (contains, icontains, trigram_similar). \u0412\u0441\u0435 \u043e\u043d\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u043d\u043e \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0445\u043e\u0440\u043e\u0448\u0438 \u0432, \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u043e\u0438\u0441\u043a\u0435. \u041f\u0440\u043e\u043b\u0438\u0441\u0442\u0430\u0432 \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435, \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 Django \u0438 Pgsql \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 document-based \u043f\u043e\u0438\u0441\u043a\u0430, \u0447\u0442\u043e \u043c\u0435\u043d\u044f \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u043b\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u043f\u043e\u0441\u0442\u0433\u0440\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0441\u0430\u043c\u043e\u0433\u043e [\u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e] \u043f\u043e\u0438\u0441\u043a\u0430. \u0418 \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, django \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 API \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0438\u0441\u043a\u0443, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0447\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0442\u043e\u0447\u043d\u0435\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u043b\u044e\u0431\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b. \u041f\u0440\u0435\u043f\u043e\u0434\u0430\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043d\u0435 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u043e\u0432\u0435\u0440\u0438\u043b, \u043c\u044b \u0441 \u043d\u0438\u043c \u043f\u043e\u0441\u043f\u043e\u0440\u0438\u043b\u0438, \u0438 \u043e\u043d \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443. \u0418 \u0432\u043e\u0442 \u044f \u0437\u0434\u0435\u0441\u044c.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-306656","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=306656"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306656\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}