{"id":207634,"date":"2014-02-07T12:14:03","date_gmt":"2014-02-07T08:14:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=207634"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=207634","title":{"rendered":"<span class=\"post_title\">Django standalone models<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/410\/2cf\/85f\/4102cf85f58f27ea311131a3ebfedfc3.jpg\" alt=\"image\" align=\"right\"\/>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u0445\u0430\u0431\u0440\u0430\u0432\u0447\u0430\u043d\u0435.<\/p>\n<p>  \u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0432\u0434\u0440\u0443\u0433 \u043e\u0442\u043a\u0440\u044b\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0432\u0441\u044e \u043c\u043e\u0449\u044c \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u0444\u043e\u0440\u043c Django.<\/p>\n<p>  \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 Django \u2014 \u044d\u0442\u043e Model-View-Template (MVT). \u041c\u043e\u0434\u0435\u043b\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0430\u0437\u0435, \u0432\u0438\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434\u043e\u043c. \u0427\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0442\u0440\u043e\u0439\u043a\u0438 \u2014 Template, \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u2014 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 Django \u0432\u043e\u043e\u0431\u0449\u0435 \u2014 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u041e\u0431 \u044d\u0442\u043e\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u0447\u0430\u0441\u0442\u044c \u2014 Model \u2014 \u0442\u0430\u043a\u0436\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u0430, \u0438 \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e \u2014 \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043a\u0443\u043f\u0435 \u0441 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0436\u0438\u0437\u043d\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c.<\/p>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u0418\u0442\u0430\u043a, \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043c\u043e\u0434\u0435\u043b\u044f\u0445.<\/p>\n<h4>\u041c\u043e\u0434\u0435\u043b\u0438<\/h4>\n<p>  \u041c\u043e\u0434\u0435\u043b\u044c \u2014 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438:  <\/p>\n<pre><code class=\"python\">class SomeModel(models.Model):     name = models.CharField('name of SomeModel', blank=True, max_length=255) <\/code><\/pre>\n<p>  Django \u0443\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u0434\u043b\u044f \u043d\u0430\u0441 \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043f\u043e\u043b\u044f, \u043d\u0430\u0432\u0440\u043e\u0434\u0435 CharField, PositiveIntegerField, EmailField \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e \u2014 \u0432\u0441\u0451 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c, \u0430 \u0447\u0435\u0433\u043e \u043d\u0435\u0442 \u2014 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u0423 \u043f\u043e\u043b\u0435\u0439 \u0435\u0441\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043b\u0438\u043d\u0430 \u043f\u043e\u043b\u044f, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041c\u043e\u0434\u0435\u043b\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 manage.py syncdb\u2026 \u0438\u043b\u0438 \u043d\u0435\u0442? \u0412\u0441\u0435\u043c \u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445? \u0417\u043d\u0430\u044e\u0449\u0438\u0435 \u043b\u044e\u0434\u0438 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u0432\u0435\u0442\u044f\u0442: \u043d\u0435\u0442, \u0432\u0435\u0434\u044c \u0435\u0441\u0442\u044c <a href=\"https:\/\/docs.djangoproject.com\/en\/1.6\/topics\/db\/models\/#abstract-base-classes\">\u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b<\/a>.<\/p>\n<h4>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b<\/h4>\n<p>  \u0417\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e:  <\/p>\n<blockquote><p>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u043f\u043e\u043b\u0435\u0437\u043d\u044b, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445. \u0412\u044b \u043f\u0438\u0448\u0438\u0442\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u0441\u0442\u0430\u0432\u0438\u0442\u0435 \u0435\u043c\u0443 abstract=True \u0432 \u0435\u0433\u043e Meta-\u043a\u043b\u0430\u0441\u0441. <b>\u042d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/b> \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u044d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u043a\u0430\u043a \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0435\u0451 \u043f\u043e\u043b\u044f \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043a \u043f\u043e\u043b\u044f\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430.<\/p><\/blockquote>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u0431\u0440\u043e\u0441\u0438\u043c \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u0430\u043a \u0441\u043a\u0443\u0447\u043d\u044b\u0439:  <\/p>\n<blockquote><p>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c Django. \u041e\u043d\u0430 \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0443 \u043d\u0435\u0451 \u043d\u0435\u0442 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430, \u0438 <b>\u043d\u0430 \u0435\u0451 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0445<\/b>. (\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434)<\/p><\/blockquote>\n<p>  \u0418 \u0432\u0441\u0451 \u0436\u0435, \u0432\u0441\u0435\u043c \u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445?<\/p>\n<h4>Standalone-\u043c\u043e\u0434\u0435\u043b\u0438<\/h4>\n<p>  \u0412 \u0441\u0432\u043e\u0451 \u0432\u0440\u0435\u043c\u044f, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 models.py, \u044f \u0445\u043e\u0442\u0435\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u0443\u0441\u043e\u0447\u043a\u043e\u0432. <a href=\"https:\/\/stackoverflow.com\/questions\/6336664\/split-models-py-into-several-files\">\u0417\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0430\u0435\u043c\u0430<\/a>, \u043d\u043e \u0432 \u0445\u043e\u0434\u0435 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u044f \u0437\u0430\u043c\u0435\u0442\u0438\u043b \u043e\u0434\u043d\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0443\u044e \u0432\u0435\u0449\u044c: \u0435\u0441\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u0434\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0432\u043d\u0435 models.py (\u0432\u043d\u0435 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 django), \u0442\u043e \u043f\u0440\u0438 manage.py syncdb \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043c\u043e\u0434\u0435\u043b\u044c\u2026 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442! \u0422\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0432\u0430\u043b\u0438\u0434\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0443 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u044b\u0442\u0432\u043e\u0440\u044f\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u043f\u0440\u043e\u0434\u0435\u043b\u044b\u0432\u0430\u0442\u044c \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 django \u2014 \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442).<\/p>\n<p>  \u0412\u043d\u0435\u0448\u043d\u0435 \u2014 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0442\u043b\u0438\u0447\u0438\u0439 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"python\"># project\/app\/StandaloneModels\/models.py # \u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u044b\u043b\u0430 \u0432 project\/app\/models.py - \u0442\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u044b class SomeModel(models.Model):     name = models.CharField('name of SomeModel', blank=True, max_length=255)  # \u0417\u0430\u0434\u0430\u0432\u0430\u0442\u044c null \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e <\/code><\/pre>\n<p>  \u042f \u0438\u0445 \u043d\u0430\u0437\u044b\u0432\u0430\u044e standalone models \u2014 \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u00ab\u043e\u0434\u0438\u043d\u043e\u043a\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u00bb \u2014 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0435 \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u0438 \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u0438\u043d\u0430\u0447\u0435.<\/p>\n<h4>\u041d\u0443 \u0438 \u0437\u0430\u0447\u0435\u043c?<\/h4>\n<p>  \u041b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441. \u0427\u0442\u043e \u043d\u0430\u043c \u0434\u0430\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438? \u0410 \u0432\u043e\u0442 \u0447\u0442\u043e:  <\/p>\n<ul>\n<li>\u041e\u043d\u0438 \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0432 python, \u043d\u043e \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u043e\u0442 django \u2014 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f email, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u043b\u0438\u043d\u044b \u043f\u043e\u043b\u0435\u0439, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u00ab\u043f\u0443\u0441\u0442\u043e\u0442\u0443\u00bb \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 dict, \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e.<\/li>\n<li>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 \u043c\u043e\u0449\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u2014 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u043e\u0442 django.<\/li>\n<\/ul>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/h4>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043c\u043e\u0435\u0439 \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u043b\u0430\u043d\u043a\u043e\u0432 \u00ab\u041f\u043e\u0447\u0442\u044b \u0420\u043e\u0441\u0441\u0438\u0438\u00bb \u0438 \u0432\u044b\u0432\u043e\u0434\u0430 pdf. \u041c\u043e\u0434\u0443\u043b\u044c \u2014 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u0432\u0440\u043e\u0434\u0435  <\/p>\n<pre><code class=\"python\">class RusPost():     def __init__(         self,         client={             'name': '',             'address': '',             'index': '',         }     ):         self.client = client      def render(self):         # ... some magic code         return render_pdf(self.client) <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 (client), \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 pdf \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c render().<\/p>\n<p>  \u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c html-\u0444\u043e\u0440\u043c\u0443 (\u0438\u043d\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f) \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439:<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/a8d\/4ae\/f6e\/a8d4aef6e33f7cab29b1ca5d097980b4.png\" alt=\"image\"\/><br \/>  \u041a\u0430\u043a\u0438\u0435 \u0442\u0443\u0442 \u0435\u0441\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438?<\/p>\n<h5>1. \u0425\u0430\u0440\u0434\u043a\u043e\u0440-\u0441\u0442\u0430\u0439\u043b \u0434\u043b\u044f \u043e\u0442\u043b\u0443\u0447\u0451\u043d\u043d\u044b\u0445 \u043e\u0442 Django<\/h5>\n<p>  \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0438\u0441\u0430\u0442\u044c html \u0444\u043e\u0440\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 view, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:  <\/p>\n<pre><code class=\"html\">&lt;!-- template.html --&gt; &lt;form action=&quot;&quot; method=&quot;POST&quot;&gt;     &lt;input type=&quot;text&quot; name=&quot;name&quot;&gt;     ...     &lt;input type=&quot;submit&quot; value=&quot;\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443&quot;&gt; &lt;\/form&gt; <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">def toPdf(request):     ruspost = RusPost(         client={             'name': request.POST.get('name', ''),             'address': request.POST.get('address', ''),             'index': request.POST.get('index', ''),         }     )     ruspost.render()     ... <\/code><\/pre>\n<p>  \u041c\u0438\u043d\u0443\u0441\u044b \u2014 \u0440\u0443\u0447\u043d\u043e\u0439 \u043c\u0430\u0440\u0442\u044b\u0448\u043a\u0438\u043d \u0442\u0440\u0443\u0434.<\/p>\n<h5>2. Form-\u0441\u0442\u0430\u0439\u043b<\/h5>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443  <\/p>\n<pre><code class=\"python\"># forms.py class RuspostClientForm(forms.Form):     name = forms.CharField()     address = forms.CharField()     index = forms.CharField() <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;!-- template.html --&gt; &lt;form action=&quot;&quot; method=&quot;POST&quot;&gt;     {{ form }}     &lt;input type=&quot;submit&quot; value=&quot;\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443&quot;&gt; &lt;\/form&gt; <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">def toPdf(request):     form = RuspostForm(request.POST or None)     if form.is_valid():         ruspost = RusPost(             client=form.cleaned_data,         )         ruspost.render()     ... <\/code><\/pre>\n<p>  \u0427\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u0438 \u0444\u043e\u0440\u043c\u044b \u2014 \u044d\u0442\u043e  <\/p>\n<ul>\n<li>\u0430\u0432\u0442\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c\u044b (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>{{ form }}<\/code>)<\/li>\n<li>\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c\u044b (<code>form.is_valid()<\/code>)<\/li>\n<li>\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0444\u043e\u0440\u043c\u044b (<code>form.cleaned_data<\/code>)<\/li>\n<\/ul>\n<h5>3. Standalone models \u0441\u0442\u0430\u0439\u043b<\/h5>\n<p>  \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u044f\u0432\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438, \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0444\u043e\u0440\u043c\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u2014 \u043e\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 standalone-\u043c\u043e\u0434\u0435\u043b\u044c:  <\/p>\n<pre><code class=\"python\">class RuspostClient(models.Model):     name = models.CharField('\u0438\u043c\u044f', max_length=64)     address = models.CharField('\u0430\u0434\u0440\u0435\u0441', max_length=255)     index = models.CharField('\u0438\u043d\u0434\u0435\u043a\u0441', max_length=6) <\/code><\/pre>\n<p>  \u041c\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u00ab\u041a\u043b\u0438\u0435\u043d\u0442\u00bb (RuspostClient) \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441 \u0442\u0430\u043a, \u043a\u0430\u043a \u043c\u044b \u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u043c \u2014 \u0438\u043c\u044f, \u0430\u0434\u0440\u0435\u0441, \u0438\u043d\u0434\u0435\u043a\u0441, \u0442\u0438\u043f \u043f\u043e\u043b\u0435\u0439 \u0438 \u0434\u043b\u0438\u043d\u0430. \u041d\u0430\u0441 \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e-\u0442\u043e \u0432\u043e\u043b\u043d\u0443\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u043f\u043e\u043b\u0435\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u043e\u0439:  <\/p>\n<pre><code class=\"python\">from django.forms.models import modelform_factory form_client = modelform_factory(RuspostClient)(request.POST or None) <\/code><\/pre>\n<p>  \u041d\u043e \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0442 \u0444\u043e\u0440\u043c\u044b:  <\/p>\n<pre><code class=\"python\">from django.forms.models import modelform_factory form_client = modelform_factory(     RuspostClient,     widgets={         'name': TextInput(attrs={'style': 'width: 300px;'}),  # \u0414\u043b\u044f \u044d\u0442\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 \u0437\u0430\u0434\u0430\u0442\u044c \u0448\u0438\u0440\u0438\u043d\u0443 300 px         'address': Textarea(attrs={'style': 'width: 300px;'}),     },     exclude=('index', ) )(     request.POST or {  # \u0417\u0430\u043f\u043e\u043b\u043d\u0438 \u043f\u043e\u043b\u044f \u0444\u043e\u0440\u043c\u044b \u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 POST (\u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0441\u0442\u044c)...         'name': '\u0410\u043d\u043e\u043d\u0438\u043c',   # ... \u043b\u0438\u0431\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0434\u0435\u0441\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u044b         'address': '\u0423\u043b. \u041f\u0443\u0448\u043a\u0438\u043d\u0430, \u0434\u043e\u043c \u041a\u0430\u043b\u0430\u0442\u0443\u0448\u043a\u0438\u043d\u0430',     } ) <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c:  <\/p>\n<pre><code class=\"python\">if form_client.is_valid():     client = form_client.save(commit=False)  # \u0411\u0435\u0437 commit=False \u0431\u0443\u0434\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430, \u0442.\u043a. \u0432 \u0411\u0414 \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u043c <\/code><\/pre>\n<p>  \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0442\u0443 \u0436\u0435 \u0441\u0430\u043c\u0443\u044e \u0444\u043e\u0440\u043c\u0443, \u0447\u0442\u043e \u0438 \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 2. \u0422\u0430\u043a \u0440\u0430\u0434\u0438 \u0447\u0435\u0433\u043e \u0431\u044b\u043b\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c?<\/p>\n<ul>\n<li>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043d\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u0430 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043c\u043e\u0434\u0435\u043b\u0438 django. \u041e\u0442\u043b\u0438\u0447\u0438\u044f \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b, \u043d\u043e, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b. \u041c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u041e\u041e\u041f \u2014 \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043a\u0443\u0434\u0430 \u043f\u0440\u0438\u044f\u0442\u043d\u0435\u0439 (\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0439) \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c client.send_email_notification(), \u0447\u0435\u043c send_email_notification(client).<\/li>\n<li>\u041c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0444\u043e\u0440\u043c\u044b \u00ab\u043d\u0430 \u043b\u0435\u0442\u0443\u00bb. \u0415\u0441\u043b\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u0441 \u043e\u0434\u043d\u0438\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438 (fieldset1), \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 (fieldset2), \u0442\u043e \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0443:<br \/> \n<pre><code class=\"python\">form_client1 = modelform_factory(     RuspostClient,     fields=fieldset1, ) form_client2 = modelform_factory(     RuspostClient,     fields=fieldset2, ) <\/code><\/pre>\n<p>  <\/li>\n<\/ul>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043c\u044b \u0442\u0430\u043a\u0438 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u0441\u0432\u043e\u0435\u043c\u0443 \u043a\u043e\u0440\u044b\u0442\u0443 \u0438\u0437 \u043f\u0443\u043d\u043a\u0442\u0430 2: <code>ruspost_client_dict = model_to_dict(ruspost_client)<\/code><\/p>\n<h4>\u0412\u044b\u0432\u043e\u0434\u044b<\/h4>\n<p>  \u041c\u044b \u0441 \u0432\u0430\u043c\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 Django, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d\u0438:<\/p>\n<ol>\n<li>\u043a\u043b\u0430\u0441\u0441\u044b<\/li>\n<li>\u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 django<\/li>\n<li>\u0443\u0434\u043e\u0431\u043d\u044b \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0445 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f)<\/li>\n<li>\u0434\u0430\u044e\u0442 \u0432\u0441\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/li>\n<li>\u0443\u0434\u043e\u0431\u043d\u044b \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u043e\u0440\u043c \u043d\u0430 \u043b\u0435\u0442\u0443 \u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 forms.py)<\/li>\n<li>\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0444\u043e\u0440\u043c\u044b, \u0442.\u0435. \u0437\u0430\u0434\u0430\u044e\u0442 \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442 (\u0430 \u0432\u043e\u0442 \u0443\u0436\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b)<\/li>\n<\/ol>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/207634\/\"> http:\/\/habrahabr.ru\/post\/207634\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/410\/2cf\/85f\/4102cf85f58f27ea311131a3ebfedfc3.jpg\" alt=\"image\" align=\"right\"\/>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u0445\u0430\u0431\u0440\u0430\u0432\u0447\u0430\u043d\u0435.<\/p>\n<p>  \u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0432\u0434\u0440\u0443\u0433 \u043e\u0442\u043a\u0440\u044b\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0432\u0441\u044e \u043c\u043e\u0449\u044c \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u0444\u043e\u0440\u043c Django.<\/p>\n<p>  \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 Django \u2014 \u044d\u0442\u043e Model-View-Template (MVT). \u041c\u043e\u0434\u0435\u043b\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0430\u0437\u0435, \u0432\u0438\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434\u043e\u043c. \u0427\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0442\u0440\u043e\u0439\u043a\u0438 \u2014 Template, \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u2014 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 Django \u0432\u043e\u043e\u0431\u0449\u0435 \u2014 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u041e\u0431 \u044d\u0442\u043e\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u0447\u0430\u0441\u0442\u044c \u2014 Model \u2014 \u0442\u0430\u043a\u0436\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u0430, \u0438 \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e \u2014 \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043a\u0443\u043f\u0435 \u0441 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0436\u0438\u0437\u043d\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c.<\/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-207634","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/207634","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=207634"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/207634\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=207634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=207634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=207634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}