{"id":18360,"date":"2022-03-24T13:55:43","date_gmt":"2022-03-24T10:55:43","guid":{"rendered":"https:\/\/mob25.com\/?p=18360"},"modified":"2023-05-09T21:48:11","modified_gmt":"2023-05-09T18:48:11","slug":"django-orm-i-modeli","status":"publish","type":"post","link":"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/","title":{"rendered":"Django ORM \u0438 \u043c\u043e\u0434\u0435\u043b\u0438"},"content":{"rendered":"\n<p>Django-\u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0443 \u0434\u0430\u043d\u043d\u044b\u0445: \u043f\u043e\u0441\u0442\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0430\u043c\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445, \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041f\u043e\u0440\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434 \u043a \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_88 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\"><\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/#%D0%9E%D0%B1%D1%8A%D0%B5%D0%BA%D1%82%D1%8B_%D0%BA%D0%BB%D0%B0%D1%81%D1%81%D0%BE%D0%B2_%D0%B8_%D0%BE%D0%B1%D1%8A%D0%B5%D0%BA%D1%82%D1%8B_%D0%B2_%D0%B1%D0%B0%D0%B7%D0%B5_%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85\" >\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/#%D0%9C%D0%BE%D0%B4%D0%B5%D0%BB%D0%B8_%D0%B2_ORM\" >\u041c\u043e\u0434\u0435\u043b\u0438 \u0432 ORM<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/#%D0%9F%D0%BE%D0%B4%D1%80%D0%BE%D0%B1%D0%BD%D1%8B%D0%B9_%D0%B2%D0%B7%D0%B3%D0%BB%D1%8F%D0%B4_%D0%BD%D0%B0_%D0%BC%D0%BE%D0%B4%D0%B5%D0%BB%D1%8C\" >\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c<\/a><\/li><\/ul><\/nav><\/div>\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%D0%9E%D0%B1%D1%8A%D0%B5%D0%BA%D1%82%D1%8B_%D0%BA%D0%BB%D0%B0%D1%81%D1%81%D0%BE%D0%B2_%D0%B8_%D0%BE%D0%B1%D1%8A%D0%B5%D0%BA%D1%82%D1%8B_%D0%B2_%D0%B1%D0%B0%D0%B7%D0%B5_%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85\"><\/span>\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u041a\u043b\u0430\u0441\u0441\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043d\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.\u0417\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u0436\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u2014 \u043d\u0430\u0431\u043e\u0440\u044b \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u0412\u044b \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u043b\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u0438\u0439, \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0441 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438. \u0415\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u0432 \u0411\u0414, \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 SQL. \u0412\u0441\u0451 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442&nbsp;<strong>Django ORM<\/strong>&nbsp;\u2014&nbsp;<em>Object-Relational Mapping<\/em>, \u00ab\u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u00bb.&nbsp;<em>Object<\/em>&nbsp;\u2014 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432,&nbsp;<em>relational<\/em>&nbsp;\u2014 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0430&nbsp;<em>mapping<\/em>&nbsp;\u2014 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<strong>Django ORM<\/strong>&nbsp;\u2014 \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0411\u0414 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0441\u0430\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 ORM \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e, \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441 ORM, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0432 Django.\u041f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u00ab\u0410\u043d\u0444\u0438\u0441\u0430 \u0434\u043b\u044f \u0434\u0440\u0443\u0437\u0435\u0439\u00bb: \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0440\u0442\u043e\u0432 \u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043e\u0433\u043e.\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d \u043e\u0431\u044a\u0435\u043a\u0442 \u00ab\u041c\u043e\u0440\u043e\u0436\u0435\u043d\u043e\u0435\u00bb.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043e\u0433\u043e.<\/li><li>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043e\u0433\u043e.<\/li><li>\u0414\u043e\u043b\u0436\u043d\u043e \u043b\u0438 \u043e\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435?<\/li><\/ul>\n\n\n\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0435\u0441\u0442\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>class IceCream:\n    def __init__(self, name, description, on_main):\n        self.name: str = text\n        self.description: str = description\n        self.on_main: bool = on_main <\/code><\/pre>\n\n\n\n<p>\u0421 \u044d\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041d\u043e \u0432 Django \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b, \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%D0%9C%D0%BE%D0%B4%D0%B5%D0%BB%D0%B8_%D0%B2_ORM\"><\/span>\u041c\u043e\u0434\u0435\u043b\u0438 \u0432 ORM<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u041a\u043b\u0430\u0441\u0441\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 ORM, \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f&nbsp;<strong>\u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438<\/strong>. \u0412 Django ORM \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441&nbsp;<strong>Model<\/strong>, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438. \u0423 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><em># \u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u0430\u0441\u0441 IceCream, \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u043a\u043b\u0430\u0441\u0441\u0430 Model \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 models<\/em>\nclass IceCream(models.Model):\n    <em># \u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0438\u0445 \u0442\u0438\u043f\u044b<\/em>\n    <em># \u0422\u0438\u043f: CharField (\u0441\u0442\u0440\u043e\u043a\u0430 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u0438\u043d\u044b)<\/em>\n    name = models.CharField(max_length=200)\n\n    <em># \u0422\u0438\u043f: TextField (\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435)<\/em>\n    <em># \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432<\/em>\n    description = models.TextField()    \n\n    <em># \u0422\u0438\u043f: \u0431\u0443\u043b\u0435\u0432\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u00ab\u0434\u0430\/\u043d\u0435\u0442\u00bb;<\/em>\n    <em># \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e: True<\/em>\n    on_main = models.BooleanField(default=True) <\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/internals\/contributing\/writing-code\/coding-style\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Django Coding Style \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442<\/a>\u00a0\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u041f\u043e\u043b\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/li><li>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430.<\/li><li><code>class&nbsp;Meta<\/code>.<\/li><li><code>def&nbsp;__str__()<\/code>.<\/li><li><code>def&nbsp;save()<\/code>.<\/li><li><code>def&nbsp;get_absolute_url()<\/code>.<\/li><li>\u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b.<\/li><\/ol>\n\n\n\n<p>\u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 Yatube \u0442\u043e\u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u043e\u0432. \u0411\u0443\u0434\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0435\u0451&nbsp;<strong>Post<\/strong>. \u0412 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u0441\u0442\u0430,<\/li><li>\u0434\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u0442\u0430,<\/li><li>\u0430\u0432\u0442\u043e\u0440 \u043f\u043e\u0441\u0442\u0430.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>class Post(models.Model): \n    <em># \u0422\u0438\u043f: TextField<\/em>\n    text = models.TextField() \n    \n    <em># \u0422\u0438\u043f \u043f\u043e\u043b\u044f: DateTimeField, \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u044b \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438;<\/em>\n    <em># \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 auto_now_add \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0447\u0442\u043e \u0432 \u043f\u043e\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438<\/em>\n    <em># \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0438 \u0434\u0430\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/em>\n    pub_date = models.DateTimeField(auto_now_add=True)\n\n    <em># \u0422\u0438\u043f: ForeignKey, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c User<\/em>\n    author = models.ForeignKey(User, on_delete=models.CASCADE) <\/code><\/pre>\n\n\n\n<p>\u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 Django ORM \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0432 \u0411\u0414 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u043e\u0434\u0435\u043b\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441&nbsp;<code>\u0438\u043c\u044f_\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 = models.\u0442\u0438\u043f_\u0434\u0430\u043d\u043d\u044b\u0445()<\/code>, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0411\u0414.\u0422\u0430\u043a, \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438&nbsp;<strong>Post<\/strong>&nbsp;\u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c\u0438&nbsp;<em>text<\/em>,&nbsp;<em>pub_date<\/em>&nbsp;\u0438&nbsp;<em>author<\/em>, \u043f\u0440\u0438\u0447\u0451\u043c \u0432 \u043a\u043e\u043b\u043e\u043d\u043a\u0435&nbsp;<em>author<\/em>&nbsp;\u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u044b&nbsp;<em>primary keys<\/em>&nbsp;\u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b&nbsp;<strong>User*<\/strong>.*\u041c\u0430\u0433\u0438\u044f ORM \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 Django \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u0442 \u043c\u0430\u0441\u0441\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0421\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li><li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 (<em>primary key<\/em>), \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0443\u0436\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.<\/li><li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430.<\/li><li>\u0421\u043e\u0437\u0434\u0430\u0441\u0442 \u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/li><li>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0445 \u0432 \u0432\u0435\u0431-\u0444\u043e\u0440\u043c\u044b.<\/li><li>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u0411\u0414.<\/li><li>\u0421\u043e\u0437\u0434\u0430\u0441\u0442 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u0438\u0441\u043a\u0430, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442 \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432 \u0438\u0445 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c.<\/li><li>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/li><li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0430\u0439\u0442\u0430.<\/li><\/ul>\n\n\n\n<p>\u0412\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%D0%9F%D0%BE%D0%B4%D1%80%D0%BE%D0%B1%D0%BD%D1%8B%D0%B9_%D0%B2%D0%B7%D0%B3%D0%BB%D1%8F%D0%B4_%D0%BD%D0%B0_%D0%BC%D0%BE%D0%B4%D0%B5%D0%BB%D1%8C\"><\/span>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435:<strong>posts\/models.py<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>from django.db import models\nfrom django.contrib.auth import get_user_model\n\nUser = get_user_model() \n\nclass Post(models.Model):\n    text = models.TextField()\n    pub_date = models.DateTimeField(auto_now_add=True)\n    author = models.ForeignKey(User, on_delete=models.CASCADE) <\/code><\/pre>\n\n\n\n<p>\u0412 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0432 \u043a\u043e\u0434 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>from django.db import models\n<em># \u0418\u0437 \u043c\u043e\u0434\u0443\u043b\u044f auth \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e get_user_model <\/em>\nfrom django.contrib.auth import get_user_model  <\/code><\/pre>\n\n\n\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044c\u00a0<code>models<\/code>, \u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044f \u0441\u043e \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c\u00a0<strong>User<\/strong>\u00a0\u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u044d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c: \u043e\u043d\u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0432 Django \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438.\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f\u00a0<a href=\"https:\/\/docs.djangoproject.com\/en\/2.2\/topics\/auth\/customizing\/#referencing-the-user-model\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043c\u043e\u0434\u0435\u043b\u0438<\/a><strong> User<\/strong>\u00a0\u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e\u00a0<code>get_user_model<\/code>. \u0421\u043b\u0435\u0434\u0443\u0435\u043c \u044d\u0442\u043e\u0439 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>User = get_user_model() <\/code><\/pre>\n\n\n\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f: \u043a\u043b\u0430\u0441\u0441&nbsp;<strong>Post<\/strong>&nbsp;\u2014 \u044d\u0442\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u043a\u043b\u0430\u0441\u0441\u0430 Model \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f&nbsp;<strong>models<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>class Post(models.Model):\n    text = models.TextField()\n    pub_date = models.DateTimeField(auto_now_add=True)\n    author = models.ForeignKey(User, on_delete=models.CASCADE) <\/code><\/pre>\n\n\n\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0435\u0439 \u0432 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0438\u043f\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0411\u0414.\u0412 \u043a\u043e\u0434\u0435 \u043c\u043e\u0434\u0435\u043b\u0438&nbsp;<strong>Post<\/strong>&nbsp;\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u043f\u043e\u043b\u044f:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>TextField<\/strong>&nbsp;\u2014 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430.<\/li><li><strong>DateTimeField<\/strong>&nbsp;\u2014 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u044b \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u0442\u0438\u043f\u044b \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u044b (<strong>DateField<\/strong>), \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (<strong>DurationField<\/strong>), \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (<strong>TimeField<\/strong>).<\/li><li><strong>ForeignKey<\/strong>&nbsp;\u2014 \u043f\u043e\u043b\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u0438\u043b\u0438, \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043d\u0430 \u0435\u0451&nbsp;<em>primary key<\/em>&nbsp;(<em>pk<\/em>). \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c&nbsp;<strong>User<\/strong>. \u042d\u0442\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u044f\u0437\u044c (<em>relation<\/em>) \u043c\u0435\u0436\u0434\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li><\/ul>\n\n\n\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440&nbsp;<code>on_delete=models.CASCADE<\/code>&nbsp;\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445: \u0435\u0441\u043b\u0438 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b&nbsp;<strong>User<\/strong>&nbsp;\u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0451\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u0432\u0441\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0438\u043c \u043f\u043e\u0441\u0442\u044b.\u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043f\u043e\u043b\u0435\u0439:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>BooleanField<\/strong>&nbsp;\u2014 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u0430&nbsp;<em>bool<\/em>.<\/li><li><strong>EmailField<\/strong>&nbsp;\u2014 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u043e \u0441 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430&nbsp;<em>email<\/em>.<\/li><li><strong>FileField<\/strong>&nbsp;\u2014 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432. \u0415\u0441\u0442\u044c \u0441\u0445\u043e\u0434\u043d\u044b\u0439, \u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f&nbsp;<strong>ImageField<\/strong>, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a.<\/li><\/ul>\n\n\n\n<p>\u0412 Django ORM \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0438\u043f\u044b \u043f\u043e\u043b\u0435\u0439.\u00a0<a href=\"https:\/\/docs.djangoproject.com\/en\/2.2\/ref\/models\/fields\/#field-types\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>\u00a0\u0434\u0430\u0451\u0442 \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u043d\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u043d\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u043f\u043e\u043b\u0435\u0439 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Django-\u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0443 \u0434\u0430\u043d\u043d\u044b\u0445: \u043f\u043e\u0441\u0442\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0430\u043c\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445, \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041f\u043e\u0440\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434 \u043a \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u041a\u043b\u0430\u0441\u0441\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043d\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.\u0417\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u0436\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u2014 \u043d\u0430\u0431\u043e\u0440\u044b \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u0412\u044b \u0443\u0436\u0435 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[187],"tags":[],"class_list":["post-18360","post","type-post","status-publish","format-standard","","category-uroki"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Django ORM \u0438 \u043c\u043e\u0434\u0435\u043b\u0438<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/\" \/>\n<meta property=\"og:locale\" content=\"ru_RU\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Django ORM \u0438 \u043c\u043e\u0434\u0435\u043b\u0438\" \/>\n<meta property=\"og:description\" content=\"Django-\u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0443 \u0434\u0430\u043d\u043d\u044b\u0445: \u043f\u043e\u0441\u0442\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0430\u043c\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445, \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041f\u043e\u0440\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434 \u043a \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u041a\u043b\u0430\u0441\u0441\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043d\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.\u0417\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u0436\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u2014 \u043d\u0430\u0431\u043e\u0440\u044b \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u0412\u044b \u0443\u0436\u0435 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/\" \/>\n<meta property=\"og:site_name\" content=\"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-24T10:55:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-09T18:48:11+00:00\" \/>\n<meta name=\"author\" content=\"violet\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/\",\"url\":\"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/\",\"name\":\"Django ORM \u0438 \u043c\u043e\u0434\u0435\u043b\u0438\",\"isPartOf\":{\"@id\":\"https:\/\/mob25.com\/blog\/#website\"},\"datePublished\":\"2022-03-24T10:55:43+00:00\",\"dateModified\":\"2023-05-09T18:48:11+00:00\",\"author\":{\"@id\":\"https:\/\/mob25.com\/blog\/#\/schema\/person\/493391ea0717532d228de3cda6d7cf45\"},\"breadcrumb\":{\"@id\":\"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/#breadcrumb\"},\"inLanguage\":\"ru-RU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\",\"item\":\"https:\/\/mob25.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Django ORM \u0438 \u043c\u043e\u0434\u0435\u043b\u0438\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mob25.com\/blog\/#website\",\"url\":\"https:\/\/mob25.com\/blog\/\",\"name\":\"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mob25.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ru-RU\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/mob25.com\/blog\/#\/schema\/person\/493391ea0717532d228de3cda6d7cf45\",\"name\":\"violet\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\/\/mob25.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d4571412769d757e8ecacdf5967ea55865839b6d95042f5fc535566d9d3533d0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d4571412769d757e8ecacdf5967ea55865839b6d95042f5fc535566d9d3533d0?s=96&d=mm&r=g\",\"caption\":\"violet\"},\"url\":\"https:\/\/mob25.com\/blog\/author\/nkl\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Django ORM \u0438 \u043c\u043e\u0434\u0435\u043b\u0438","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/","og_locale":"ru_RU","og_type":"article","og_title":"Django ORM \u0438 \u043c\u043e\u0434\u0435\u043b\u0438","og_description":"Django-\u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0443 \u0434\u0430\u043d\u043d\u044b\u0445: \u043f\u043e\u0441\u0442\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0430\u043c\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445, \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041f\u043e\u0440\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434 \u043a \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u041a\u043b\u0430\u0441\u0441\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043d\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.\u0417\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u0436\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u2014 \u043d\u0430\u0431\u043e\u0440\u044b \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u0412\u044b \u0443\u0436\u0435 [&hellip;]","og_url":"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/","og_site_name":"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438","article_published_time":"2022-03-24T10:55:43+00:00","article_modified_time":"2023-05-09T18:48:11+00:00","author":"violet","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/","url":"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/","name":"Django ORM \u0438 \u043c\u043e\u0434\u0435\u043b\u0438","isPartOf":{"@id":"https:\/\/mob25.com\/blog\/#website"},"datePublished":"2022-03-24T10:55:43+00:00","dateModified":"2023-05-09T18:48:11+00:00","author":{"@id":"https:\/\/mob25.com\/blog\/#\/schema\/person\/493391ea0717532d228de3cda6d7cf45"},"breadcrumb":{"@id":"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/#breadcrumb"},"inLanguage":"ru-RU","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mob25.com\/blog\/django-orm-i-modeli\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/mob25.com\/blog\/django-orm-i-modeli\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430","item":"https:\/\/mob25.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Django ORM \u0438 \u043c\u043e\u0434\u0435\u043b\u0438"}]},{"@type":"WebSite","@id":"https:\/\/mob25.com\/blog\/#website","url":"https:\/\/mob25.com\/blog\/","name":"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mob25.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ru-RU"},{"@type":"Person","@id":"https:\/\/mob25.com\/blog\/#\/schema\/person\/493391ea0717532d228de3cda6d7cf45","name":"violet","image":{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/mob25.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d4571412769d757e8ecacdf5967ea55865839b6d95042f5fc535566d9d3533d0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d4571412769d757e8ecacdf5967ea55865839b6d95042f5fc535566d9d3533d0?s=96&d=mm&r=g","caption":"violet"},"url":"https:\/\/mob25.com\/blog\/author\/nkl\/"}]}},"_links":{"self":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/posts\/18360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/comments?post=18360"}],"version-history":[{"count":0,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/posts\/18360\/revisions"}],"wp:attachment":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/media?parent=18360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/categories?post=18360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/tags?post=18360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}