{"id":308184,"date":"2020-08-08T15:00:24","date_gmt":"2020-08-08T15:00:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=308184"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=308184","title":{"rendered":"\u0428\u0435\u0441\u0442\u044c Python-\u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 Django"},"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\/514348\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ip\/c1\/cj\/ipc1cjiixncyr19h-bp0ymwi0h0.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0431\u0435\u0441\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e Python-\u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u041d\u043e \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 Django, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0449\u0438\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u0435\u0445 \u043f\u0430\u043a\u0435\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e, \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u0445, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0438\u0445 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043a \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 Python-\u043f\u0430\u043a\u0435\u0442\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043f\u0430\u043a\u0435\u0442\u044b, \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u043c\u044b\u0435 \u043d\u0438\u0436\u0435, \u2014 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0445\u043e\u0434\u043e\u0432\u044b\u0435 \u0438\u0437 Django-\u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3 id=\"veb-freymvork-django\">\u0412\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Django<\/h3>\n<p>  <\/p>\n<p>\u041d\u043e \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a Django-\u043f\u0430\u043a\u0435\u0442\u0430\u043c, \u043d\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0432 \u043e \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 Django.<br \/>  \u0412\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0438\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0438 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.djangoproject.com\/\" rel=\"nofollow\">Django<\/a> \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442-\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u043c (\u043f\u0440\u0438\u043c. \u043f\u0435\u0440.: full-stack) \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440, \u043c\u043e\u0434\u0443\u043b\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0441\u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f. \u042d\u0442\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430, \u0438 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u0438. <\/p>\n<p>  <\/p>\n<h3 id=\"ustanovka-django\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Django:<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b macOS<\/p>\n<p>  <\/p>\n<pre><code class=\"django\">(env)User-Macbook:env user$ pip install django<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 Windows<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">(env)C:\\Users\\Owner\\desktop\\env&gt; pip install django<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0441\u0438\u044f Django \u2014 3.0.8. \u0412\u0441\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u2014 \u044d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <strong>pip install django<\/strong>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u0442\u043e \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0435\u0435 \u043d\u043e\u043c\u0435\u0440, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 <strong>pip install django==2.1.15<\/strong>. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0442\u0430\u043c \u0434\u0432\u0430 \u0437\u043d\u0430\u043a\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u043f\u043e\u0441\u043b\u0435 \u0438\u043c\u0435\u043d\u0438 \u043f\u0430\u043a\u0435\u0442\u0430, \u0430 \u043d\u0435 \u043e\u0434\u0438\u043d.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Django. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0441\u0432\u043e\u0435\u0433\u043e \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Django, \u0442\u043e \u0432\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 \u043a\u0440\u0430\u0442\u043a\u0438\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430: <a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/quick-start-django-installation\" rel=\"nofollow\">\u043f\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 Django<\/a> \u0438 \u043f\u043e <a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/quick-start-django-configuration\" rel=\"nofollow\">\u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/a>. \u0418\u043b\u0438, \u0435\u0441\u043b\u0438 \u0432\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b\u0438, \u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u0443\u0447\u0435\u0431\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u00ab<a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/django-beginners-guide\" rel=\"nofollow\">\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c \u043d\u0430 Django \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445<\/a>\u00bb.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u043c\u044b \u0437\u0434\u0435\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e Python-\u043f\u0430\u043a\u0435\u0442\u0430\u0445, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 Django, \u0430 \u043d\u0435 \u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u0445 Django, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043c\u043d\u043e\u0433\u043e\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<h3 id=\"1-django-tinymce4-lite\">(1) Django TinyMCE4 Lite<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b macOS<\/p>\n<p>  <\/p>\n<pre><code class=\"django\">(env)User-Macbook:mysite user$ pip install django-tinymce4-lite<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 Windows<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">(env) C:\\Users\\Owner\\Desktop\\Code\\env\\mysite&gt;pip install django-tinymce4-lite<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u0441 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0441\u0432\u043e\u0435\u0433\u043e \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 Python-\u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pypi.org\/project\/django-tinymce4-lite\/\" rel=\"nofollow\">django-tinymce4-lite<\/a>. \u042d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u2014 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f Django-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f django-tinymce4, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0432\u0438\u0434\u0436\u0435\u0442 \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u043f\u043e\u043b\u0435\u0439 Django-\u0444\u043e\u0440\u043c\u044b \u0432 \u0432\u0438\u0434\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u0432 TinyMCE.<\/p>\n<p>  <\/p>\n<p>TinyMCE \u2014 \u044d\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 WSIWYG (\u00ab\u0447\u0442\u043e \u0432\u0438\u0434\u0438\u0448\u044c, \u0442\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0448\u044c\u00bb) \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 HTML-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0438\u043b\u0438 \u0432 \u00ab\u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u043a\u0441\u0442\u00bb. \u042d\u0442\u043e\u0442 Python-\u043f\u0430\u043a\u0435\u0442 \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u043b\u043e\u0433, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043b\u0435\u0433\u043a\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0442\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 HTML \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; mysite &gt; settings.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">INSTALLED_APPS = [     ...     ...     'tinymce', ]  TINYMCE_DEFAULT_CONFIG = {     'height': 400,     'width': 1000,     'cleanup_on_startup': True,     'custom_undo_redo_levels': 20,     'selector': 'textarea',     'browser_spellcheck': 'true',     'theme': 'modern',     'plugins': '''             textcolor save link image media preview codesample contextmenu             table code lists fullscreen  insertdatetime  nonbreaking             contextmenu directionality searchreplace wordcount visualblocks             visualchars code fullscreen autolink lists  charmap print  hr             anchor pagebreak             ''',     'toolbar1': '''             fullscreen preview bold italic underline | fontselect,             fontsizeselect  | forecolor backcolor | alignleft alignright |             aligncenter alignjustify | indent outdent | bullist numlist table |             | link image media | codesample             ''',     'toolbar2': '''             visualblocks visualchars |             charmap hr pagebreak nonbreaking anchor |  code |             ''',     'contextmenu': 'formats | link image',     'menubar': True,     'statusbar': True, }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c tinymce \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u0444\u0430\u0439\u043b\u0435 settings.py, \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0438\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0432\u044b\u0441\u043e\u0442\u0443, \u0448\u0438\u0440\u0438\u043d\u0443, \u043f\u0430\u043d\u0435\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043e\u0440\u0444\u043e\u0433\u0440\u0430\u0444\u0438\u0438.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; mysite &gt; urls.py<br \/>  <\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">&quot;&quot;&quot;mysite URL Configuration  The `urlpatterns` list routes URLs to views. For more information please see:      https:\/\/docs.djangoproject.com\/en\/2.1\/topics\/http\/urls\/ Examples: Function views     1. Add an import:  from my_app import views     2. Add a URL to urlpatterns:  path('', views.home, name='home') Class-based views     1. Add an import:  from other_app.views import Home     2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home') Including another URLconf     1. Import the include() function: from django.urls import include, path     2. Add a URL to urlpatterns:  path('blog\/', include('blog.urls')) &quot;&quot;&quot; from django.contrib import admin from django.urls import path, include  urlpatterns = [     path('admin\/', admin.site.urls),     path('', include ('main.urls')),     path('tinymce\/', include('tinymce.urls')), #add this<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u0443\u0442\u044c \u043a tinymce \u0432 URL-\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; models.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">from django.db import models from tinymce import HTMLField  class MyModel(models.Model):     ...     content = HTMLField()<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c TinyMCE \u0432 Django-\u043c\u043e\u0434\u0435\u043b\u044c, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044f HTMLField \u043d\u0430\u0432\u0435\u0440\u0445\u0443 \u0444\u0430\u0439\u043b\u0430 \u0438 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0435\u0433\u043e \u0432 \u043f\u043e\u043b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u043a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f Django-\u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0441\u0442\u0430\u0442\u044c\u044e \u00ab\u041a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f Django-\u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438\u00bb \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<h3 id=\"1-pillow\">(1) Pillow<\/h3>\n<p>  <\/p>\n<p><em>\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b macOS<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">(env)User-Macbook:mysite user$ pip install Pillow<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 Windows<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">(env) C:\\Users\\Owner\\Desktop\\Code\\env\\mysite&gt;pip install Pillow<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430, \u044d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 Django, \u043d\u043e \u043e\u043d \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432 Django-\u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u043c\u0435\u0434\u0438\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0432\u043e\u0435\u0439 Django-\u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f, \u0441\u043a\u0430\u0436\u0435\u043c, \u043e\u0431\u043b\u043e\u0436\u043a\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"https:\/\/pillow.readthedocs.io\/en\/stable\/installation.html\" rel=\"nofollow\">Pillow<\/a>. \u042d\u0442\u043e \u0444\u043e\u0440\u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Python Imaging Library \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; mysite &gt; settings.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">MEDIA_URL = '\/media\/'  MEDIA_ROOT = os.path.join(BASE_DIR, 'media')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c URL \u043a \u043f\u0430\u043f\u043a\u0435 \u0434\u043b\u044f \u043c\u0435\u0434\u0438\u0430\u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043a\u043e\u0440\u043d\u0435\u0432\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0432 \u0444\u0430\u0439\u043b settings.py.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; mysite &gt; urls.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">from django.contrib import admin from django.urls import path, include from django.conf import settings  # add this from django.conf.urls.static import static  # add this  urlpatterns = [     path('admin\/', admin.site.urls),     path('', include('main.urls')), ]  if settings.DEBUG:  # add this     urlpatterns += static(settings.MEDIA_URL,                           document_root=settings.MEDIA_ROOT)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u044b \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0444\u0430\u0439\u043b\u0430 urls.py \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c URL-\u0448\u0430\u0431\u043b\u043e\u043d \u043a \u043f\u0430\u043f\u043a\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0434\u0438\u0430\u0444\u0430\u0439\u043b\u043e\u0432. \u0418\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u0435\u0434\u0438\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0430\u0439\u0442 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0441 \u044d\u0442\u043e\u0439 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439. \u0412\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u0435\u0434\u0438\u0430\u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; models.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">from django.db import models  class MyModel(models.Model):     ...     image = models.ImageField(upload_to='images\/')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u0432\u0430\u0448 \u0444\u0430\u0439\u043b \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u043e\u043b\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 ImageField \u0441 &#8216;images\/&#8217; \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438. \u0412\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u043f\u0430\u043f\u043a\u0443 media &gt; images, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043f\u0440\u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438, \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 Django \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443 \u00ab<a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/django-models\" rel=\"nofollow\">\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 Django<\/a>\u00bb.<\/p>\n<p>  <\/p>\n<h3 id=\"3-django-crispy-forms\">(3) Django Crispy Forms<\/h3>\n<p>  <\/p>\n<p><em>\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b macOS<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">(env)User-Macbook:mysite user$ pip install django-crispy-forms<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 Windows<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">(env) C:\\Users\\Owner\\desktop\\code\\env\\mysite&gt;pip install django-crispy-forms<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0444\u043e\u0440\u043c\u0430\u0445 Django. \u0423 \u043d\u0438\u0445 \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 django-crispy-forms, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; mysite &gt; settings.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">INSTALLED_APPS = [     ...     'crispy_forms', ]  CRISPY_TEMPLATE_PACK = 'uni_form'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0430\u043a\u0435\u0442\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0444\u0430\u0439\u043b settings.py \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <strong>crispy_forms<\/strong> \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u043c\u0435\u0436\u0434\u0443 crispy \u0438 forms \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0438\u0436\u043d\u0435\u0435 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 crispy-\u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u0422\u043e\u0442, \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d \u043d\u0438\u0436\u0435 (\u043f\u0440\u0438\u043c. \u043f\u0435\u0440.: \u043d\u0438\u0436\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 INSTALLED_APPS), \u2014 \u043f\u0430\u043a\u0435\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 CSS-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Bootstrap, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043a\u0430\u043a <a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/render-a-django-form-with-bootstrap\" rel=\"nofollow\">\u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Bootstrap \u0441 django-crispy-forms<\/a>.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; templates &gt; main &gt; contact.html<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">{% load crispy_forms_tags %}  &lt;form method=&quot;post&quot;&gt;     {% csrf_token %}        {{form|crispy}}        &lt;button type=&quot;submit&quot;&gt;Submit&lt;\/button&gt; &lt;\/form&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0430\u043a\u0435\u0442 django-crispy-forms \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0444\u043e\u0440\u043c\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 <strong>{{form}}<\/strong> \u044f\u0437\u044b\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 Django. \u042d\u0442\u0430 \u0444\u043e\u0440\u043c\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0444\u043e\u0440\u043c\u044b, \u043d\u043e \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u0430\u043a\u0435\u0442\u043e\u043c crispy-\u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0432 \u0444\u0430\u0439\u043b\u0435 settings.py.<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a \u0441\u0442\u0430\u0442\u044c\u0435 \u00ab<a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/render-forms-with-django-crispy-forms\" rel=\"nofollow\">\u0420\u0435\u043d\u0434\u0435\u0440\u044c\u0442\u0435 \u0444\u043e\u0440\u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Django Crispy Forms<\/a>\u00bb \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0444\u043e\u0440\u043c, \u0438 \u043a \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/build-a-django-contact-form-with-email-backend\" rel=\"nofollow\">\u00ab\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u0443\u044e Django-\u0444\u043e\u0440\u043c\u0443 \u0441 \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b\u00bb<\/a> \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 Django-\u0444\u043e\u0440\u043c.<\/p>\n<p>  <\/p>\n<h3 id=\"4-django-tables\">(4) Django Tables<\/h3>\n<p>  <\/p>\n<p><em>\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b macOS<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">(env)User-Macbook:mysite user$ pip install django-tables2<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 Windows<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">(env) C:\\Users\\Owner\\desktop\\code\\env\\mysite&gt;pip install django-tables2<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432 \u0441\u0432\u043e\u0435\u043c Django-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 django-tables2 \u2014 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 Django \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0442\u0430\u0431\u043b\u0438\u0446.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; mysite &gt; settings.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">INSTALLED_APPS = [     ...     'django_tables2', ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u00abDjango tables\u00bb \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; models.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">from django.db import models  class MyModel(models.Model):     name = models.CharField(max_length=100, verbose_name=&quot;full name&quot;)     email = models.EmailField(max_length=200)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <strong>python manage.py makemigrations<\/strong> \u0438 <strong>python manage.py migrate<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u0432\u043e\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0430\u0434\u043c\u0438\u043d\u043a\u0443 Django. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u00ab<a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/django-models\" rel=\"nofollow\">\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 Django<\/a>\u00bb \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; (\u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b) tables.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">import django_tables2 as tables from .models import MyModel  class MyTable(tables.Table):     class Meta:         model = MyModel         fields = (&quot;name&quot;, &quot;email&quot;, )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c tables.py \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u0432 main, \u0438 \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0444\u0430\u0439\u043b\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 django_tables2, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c tables. \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0434\u0430\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0438\u043c\u0435\u043d\u0430 \u043f\u043e\u043b\u0435\u0439.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; views.py (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u043a\u043b\u0430\u0441\u0441\u044b)<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">... from django_tables2 import SingleTableView  from .models import MyModel from .tables import MyTable  class ListView(SingleTableView):     model = MyModel     table_class = MyTable     template_name = 'main\/table.html'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u043a\u043b\u0430\u0441\u0441\u044b, \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u0444\u0430\u0439\u043b views.py \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0437\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u044c, \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d. \u0412\u0430\u043c \u0441\u043d\u043e\u0432\u0430 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; urls.py (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u043a\u043b\u0430\u0441\u0441\u044b)<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">from django.urls import path from . import views  app_name = &quot;main&quot;  urlpatterns = [     path(&quot;table&quot;, views.ListView.as_view()), ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 urls.py \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c URL \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445-\u043a\u043b\u0430\u0441\u0441\u0430\u0445, \u0432\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u044e <a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/django-class-based-views\" rel=\"nofollow\">\u00ab\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u043a\u043b\u0430\u0441\u0441\u044b Django\u00bb<\/a>.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; views.py (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u0444\u0443\u043d\u043a\u0446\u0438\u0438)<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">... from django_tables2 import SingleTableView  from .models import MyModel from .tables import MyTable  def list(request):     model = MyModel.objects.all()     table = MyTable(model)     return render(request=request, template_name=&quot;main\/table.html&quot;, context={&quot;model&quot;:model, &quot;table&quot;:table})<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u043b\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 views.py. \u041b\u044e\u0431\u043e\u0439 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430 \u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; urls.py (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u0444\u0443\u043d\u043a\u0446\u0438\u0438)<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">from django.urls import path from . import views  app_name = &quot;main&quot;     urlpatterns = [     path(&quot;table&quot;, views.list, name=&quot;list&quot;), ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 URL \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 urls.py \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; templates &gt; main &gt; (\u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b) table.html<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">{ % load render_table from django_tables2 % }  &lt;div &gt;     { % render_table table % } &lt;\/div &gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435, \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u044f <strong>render_table from django_tables2<\/strong> \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0444\u0430\u0439\u043b\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u044f <strong>render_table<\/strong> \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0439 \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435-\u043a\u043b\u0430\u0441\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a <strong>table<\/strong>, \u0438 \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u0442\u043e\u0436\u0435 \u0440\u0435\u0448\u0438\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043a\u0430\u043a <strong>table.<\/strong><\/p>\n<p>  <\/p>\n<p>*\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c CSS \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Bootstrap \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<p>  <\/p>\n<p>env &gt; mysite &gt; main &gt; tables.py*<\/p>\n<p>  <\/p>\n<pre><code class=\"django\">import django_tables2 as tables from .models import MyModel  class MyTable(tables.Table):     class Meta:         model = MyModel         template_name = &quot;django_tables2\/bootstrap4.html&quot;         fields = (&quot;name&quot;, &quot;email&quot;,)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0438\u043c\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c Bootstrap, \u0432 \u0444\u0430\u0439\u043b tables.py. \u042d\u0442\u043e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 Lib &gt; site-packages &gt; django_tables2 &gt; templates &gt; django_tables2 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; templates &gt; main &gt; (\u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b) table.html<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">{% extends &quot;main\/header.html&quot; %}  {% block content %}  {% load render_table from django_tables2 %}  &lt;div class=&quot;container&quot;&gt;     {% render_table table %} &lt;\/div&gt;  {% endblock %}<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0448\u0430\u043f\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 CDN-\u044b \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Bootstrap. \u042d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f Bootstrap \u0432\u043e \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u043a\u0443\u0441\u043a\u0430 \u043a\u043e\u0434\u0430.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0433 extends \u0441 CDN-\u043c\u0438 Bootstrap, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043b \u00abDjango extends tag and block content\u00bb (\u043f\u0440\u0438\u043c. \u043f\u0435\u0440.: Django-\u0442\u0435\u0433 extends \u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0431\u043b\u043e\u043a\u0430) \u0432 <a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/django-beginners-guide\" rel=\"nofollow\">\u00ab\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043f\u043e \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c \u043d\u0430 Django \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445\u00bb<\/a>.<\/p>\n<p>  <\/p>\n<h3 id=\"5-django-filter\">(5) Django Filter<\/h3>\n<p>  <\/p>\n<p><em>\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b macOS<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">(env)User-Macbook:mysite user$  pip install django-filter<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 Windows<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">(env) C:\\Users\\Owner\\desktop\\code\\env\\mysite&gt;  pip install django-filter<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0432\u0430\u043c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043a\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0441\u0442\u0440\u043e\u043a \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/django-filter.readthedocs.io\/en\/stable\/\" rel=\"nofollow\">django-filter<\/a> \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0440\u0445 \u043f\u0430\u043a\u0435\u0442\u0430 django-tables2, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; mysite &gt; settings.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">INSTALLED_APPS = [     ...     'django_filters', ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 Django-\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0432 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u043e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f <strong>django_filters<\/strong>, \u0430 \u043d\u0435 <strong>django_filter<\/strong>.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; (\u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b) filters.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">import django_filters from .models import MyModel  class MyFilter(django_filters.FilterSet):     name = django_filters.CharFilter(lookup_expr='icontains')      class Meta:         model = MyModel         fields = {'name', 'email'}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u0432 main, \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c filters.py, \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 django_filters. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u043e\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e. <\/p>\n<p>  <\/p>\n<p>\u0412\u044b \u0440\u0435\u0448\u0430\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <strong>django_filters.CharFilter<\/strong> \u0432 \u043a\u043b\u0430\u0441\u0441, \u0433\u0434\u0435 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0444\u0438\u043b\u044c\u0442\u0440 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043b\u044e\u0431\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 name \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>django_filters.CharFilter(lookup_expr=&#8217;iexact&#8217;)<\/strong>, \u0435\u0441\u043b\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0441\u0442\u0440\u043e\u0433\u043e\u043c\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; views.py (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u043a\u043b\u0430\u0441\u0441\u044b)<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">... from django_tables2 import SingleTableMixin from django_filters.views import FilterView  from .models import MyModel from .tables import MyTable from .filters import MyFilter  class ListView(SingleTableMixin, FilterView):     model = MyModel     table_class = MyTable     template_name = 'main\/table.html'     filterset_class = MyFilter<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u043a\u043b\u0430\u0441\u0441\u0430, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 <strong>FilterView <\/strong>\u0438\u0437 django_filters.views \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0444\u0430\u0439\u043b\u0430 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u0438\u043c\u043f\u043e\u0440\u0442 django_tables2 \u0441 <strong>SingleTableView<\/strong> \u043d\u0430 <strong>SingleTableMixin<\/strong>. \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 filter.py.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435-\u043a\u043b\u0430\u0441\u0441 <strong>ListView <\/strong>\u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 <strong>SingleTableMixin <\/strong>\u0438 <strong>FilterView <\/strong>\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <strong>filterset_class<\/strong>, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; templates &gt; main &gt; table.html<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">{% load render_table from django_tables2 %}  &lt;div&gt;     &lt;br&gt;     &lt;form action=&quot;&quot; method=&quot;GET&quot;&gt;         {{filter.form}}         &lt;button type=&quot;submit&quot;&gt;Filter&lt;\/button&gt;     &lt;\/form&gt;     &lt;br&gt;     {% render_table table %} &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438-\u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 URL \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0442\u0435\u043c \u0436\u0435, \u043d\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c HTML-\u044d\u043b\u0435\u043c\u0435\u043d\u0442 form \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044f\u0437\u044b\u043a \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 Django, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0438 \u0444\u043e\u0440\u043c\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u0422\u0430\u043a\u0436\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u043e\u0440\u043c\u044b \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u0442\u0438\u043f\u0430 submit, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e. \u0412 \u0441\u043f\u043e\u0441\u043e\u0431\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; views.py (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u0444\u0443\u043d\u043a\u0446\u0438\u0438)<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">... from django_tables2.views import SingleTableMixin from django_filter import FilterView  from .models import MyModel from .tables import MyTable  def list(request):     model = MyModel.objects.all()     filterset_class = MyFilter(request.GET, model)     table = MyTable(filterset_class.qs)     return render(request=request, template_name=&quot;main\/table.html&quot;, context={&quot;model&quot;:model, &quot;table&quot;:table, &quot;filterset_class&quot;:filterset_class})<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439-\u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0442\u0435 \u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u0447\u0442\u043e \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438-\u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438, \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 MyFilter \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u00abGET\u00bb \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043c\u043e\u0434\u0435\u043b\u044c. \u041f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 filterset_class \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u043f\u0440\u0438\u043c. \u043f\u0435\u0440.: queryset) \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u0443\u043a\u0430\u0436\u0438\u0442\u0435 filterset_class \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 render.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; main &gt; templates &gt; main &gt; table.html<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">{% load render_table from django_tables2 %}  &lt;div&gt;     &lt;br&gt;     &lt;form action=&quot;&quot; method=&quot;GET&quot;&gt;         {{filterset_class.form}}         &lt;button type=&quot;submit&quot;&gt;Filter&lt;\/button&gt;     &lt;\/form&gt;     &lt;br&gt;     {% render_table table %} &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439-\u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c <strong>filterset_class<\/strong>, \u0438\u043b\u0438 \u0438\u043c\u044f, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u044b. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u043a\u043b\u0430\u0441\u0441\u0430. <\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u0441\u0442\u0438\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443, \u0442\u043e \u043b\u0438\u0431\u043e \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432\u0432\u0435\u0440\u0445 \u0434\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 Django Crispy Forms, \u043b\u0438\u0431\u043e \u043a\u043b\u0438\u043a\u043d\u0438\u0442\u0435 \u043d\u0430 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u0443\u044e \u0440\u0430\u043d\u0435\u0435 \u0441\u0442\u0430\u0442\u044c\u044e \u2014 <a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/render-forms-with-django-crispy-forms\" rel=\"nofollow\">\u00ab\u0420\u0435\u043d\u0434\u0435\u0440\u044c\u0442\u0435 \u0444\u043e\u0440\u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Django Crispy Forms\u00bb<\/a>.<\/p>\n<p>  <\/p>\n<h3 id=\"6-python-decouple\">(6) Python Decouple<\/h3>\n<p>  <\/p>\n<p><em>\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b macOS<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">(env)User-Macbook:mysite user$ pip install python-decouple<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 Windows<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">(env) C:\\Users\\Owner\\desktop\\code\\env\\mysite&gt; pip install python-decouple<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439, \u0438 \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u044b\u0439 Python-\u043f\u0430\u043a\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u2014 \u044d\u0442\u043e <a href=\"https:\/\/pypi.org\/project\/python-decouple\/\" rel=\"nofollow\">python-decouple<\/a>. \u042d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0430\u0448\u0438 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0442 \u0445\u0430\u043a\u0435\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e\u043d \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0434\u043b\u044f Django, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u00ab\u0442\u0438\u043f\u043e\u0432\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u00bb \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; (\u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b) .env<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">SECRET_KEY =sdjioerb43buobnodhioh4i34hgip DEBUG =True<\/code><\/pre>\n<p>  <\/p>\n<p><em>env &gt; mysite &gt; mysite &gt; settings.py<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"django\">from decouple import config  SECRET_KEY = config('SECRET_KEY') DEBUG = config('DEBUG', cast=bool)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c .env \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0437\u0430\u0442\u0435\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 config \u0432 \u0444\u0430\u0439\u043b\u0435 settings.py. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0438\u0442\u0435 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0436\u0435\u043b\u0430\u0435\u0442\u0435 \u0441\u043a\u0440\u044b\u0442\u044c, \u0432 \u0444\u0430\u0439\u043b .env \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u043a\u0430\u0436\u0434\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f python-decouple \u0444\u043e\u0440\u043c\u0430\u0442 config(&#8216;variable&#8217;).<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <a href=\"https:\/\/www.ordinarycoders.com\/blog\/article\/secure-django-variables-with-python-decouple\" rel=\"nofollow\">\u00ab\u041e\u0431\u0435\u0441\u043f\u0435\u0447\u044c\u0442\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 Django, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Python Decouple\u00bb<\/a>.<\/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\/514348\/\"> https:\/\/habr.com\/ru\/post\/514348\/<\/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\/514348\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ip\/c1\/cj\/ipc1cjiixncyr19h-bp0ymwi0h0.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0431\u0435\u0441\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e Python-\u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u041d\u043e \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 Django, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0449\u0438\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u0435\u0445 \u043f\u0430\u043a\u0435\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e, \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u0445, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0438\u0445 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043a \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 Python-\u043f\u0430\u043a\u0435\u0442\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043f\u0430\u043a\u0435\u0442\u044b, \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u043c\u044b\u0435 \u043d\u0438\u0436\u0435, \u2014 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0445\u043e\u0434\u043e\u0432\u044b\u0435 \u0438\u0437 Django-\u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/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-308184","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/308184","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=308184"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/308184\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=308184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=308184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=308184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}