{"id":224249,"date":"2014-05-27T14:52:03","date_gmt":"2014-05-27T10:52:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=224249"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=224249","title":{"rendered":"<span class=\"post_title\">\u0427\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0432 Django 1.7<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043e\u0431\u0437\u043e\u0440 \u043d\u043e\u0432\u0448\u0435\u0441\u0442\u0432 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0438 Python \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Django 1.7. \u0420\u0435\u043b\u0438\u0437 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c, \u0442\u0430\u043a \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u2014 \u043a\u0430\u043a \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0439 \u0440\u0435\u043b\u0438\u0437, \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0445\u043e\u0434\u0430 \u0432 \u0441\u0432\u0435\u0442 Django 1.0.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/37e\/465\/2cc\/37e4652cc459cf199d92030a0887268e.jpg\" alt=\"image\"\/><br \/>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u041d\u043e\u0432\u0448\u0435\u0441\u0442\u0432\u0430 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 1.7<\/h4>\n<p>  \u041f\u0440\u0435\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Python 2.6. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0440\u0441\u0438\u044f Python 2.7 \u0438 \u0432\u044b\u0448\u0435. \u0417\u0430\u044f\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 Python 3.4.<br \/>  \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/migrations\/\">\u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439<\/a> \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0438\u0442\u044c \u0437\u0430 \u044d\u0442\u043e \u0430\u0432\u0442\u043e\u0440\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u0431\u0430\u0442\u0430\u0440\u0435\u0439\u043a\u0438 South \u2014 <a href=\"https:\/\/github.com\/andrewgodwin\">Andrew Godwin-\u0430<\/a>.<\/p>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 syncdb \u043e\u0431\u044c\u044f\u0432\u043b\u0435\u043d\u0430 \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0430\u044f, \u0438 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0430 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c. \u041f\u043e\u043a\u0430 \u0435\u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u043f\u0440\u0435\u0436\u0434\u0435.<br \/>  \u0424\u0438\u043a\u0441\u0442\u0443\u0440\u044b initial_data \u0431\u043e\u043b\u0435\u0435 \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0444\u0438\u043a\u0441\u0442\u0443\u0440 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0430\u043c\u0438\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439.<\/p>\n<p>  \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/applications\/\">\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/a> \u2014 \u0431\u044b\u043b \u043f\u043e\u0434\u0432\u0435\u0440\u0433\u043d\u0443\u0442 \u043f\u043e\u043b\u043d\u043e\u043c\u0443 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0443. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 models.py, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0431\u044b\u043b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c.<br \/>  \u041d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u043e\u0432 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/howto\/custom-model-fields\/#django.db.models.Field\">Field<\/a>. \u0413\u043b\u0430\u0432\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u044d\u0442\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 deconstruct(). \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0432 \u044d\u0442\u043e\u043c \u0432\u0438\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 Django. \u0415\u0441\u043b\u0438 \u0412\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0435\u0441\u044c \u043e\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0435 \u043c\u0435\u0442\u043e\u0434 __init__, \u0442\u043e \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u0412\u0430\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u043e\u0432 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/db\/managers\/#create-manager-with-queryset-methods\">QuerySet-\u043e\u0432<\/a> \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430:  <\/p>\n<pre><code class=\"python\">class FoodQuerySet(models.QuerySet):     def pizzas(self):         return self.filter(kind='pizza')      def vegetarian(self):         return self.filter(vegetarian=True)  class Food(models.Model):     kind = models.CharField(max_length=50)     vegetarian = models.BooleanField()     objects = FoodQuerySet.as_manager()  Food.objects.pizzas().vegetarian() <\/code><\/pre>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439:  <\/p>\n<pre><code class=\"python\">class Blog(models.Model):     pass  class Entry(models.Model):     blog = models.ForeignKey(Blog)      objects = models.Manager()  # Default Manager     entries = EntryManager()    # Custom Manager  b = Blog.objects.get(id=1) b.entry_set(manager='entries').all() <\/code><\/pre>\n<p>  \u041d\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430(System check), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043e\u043f\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0447\u0442\u043e \u0438 \u043a\u0430\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 check, \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0430\u044f \u043d\u0430 \u0437\u0430\u043c\u0435\u043d\u0443 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 validate.<br \/>  \u041d\u043e\u0432\u044b\u0439 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/models\/queries\/#django.db.models.Prefetch\">Prefetch<\/a> \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 prefetch_related. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f QuerySet-\u044b.<\/p>\n<p>  \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u044f\u0441\u0430 \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430, \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u043c \u0434\u0430\u0442\u044b. \u041f\u0440\u0435\u0436\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u043f\u043e\u044f\u0441 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u041f\u0440\u0438 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u2014 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430.<\/p>\n<p>  \u041a\u0443\u0440\u0441\u043e\u0440 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430:  <\/p>\n<pre><code class=\"python\">c = connection.cursor() try:     c.execute(...) finally:     c.close() <\/code><\/pre>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/models\/custom-lookups\/#django.db.models.Lookup\">\u0442\u0438\u043f\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430<\/a>, \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 ORM.  <\/p>\n<pre><code class=\"python\">from django.db.models import IntegerField from django.db.models import Transform  class AbsoluteValue(Transform):     lookup_name = 'abs'      def as_sql(self, qn, connection):         lhs, params = qn.compile(self.lhs)         return &quot;ABS(%s)&quot; % lhs, params  IntegerField.register_lookup(AbsoluteValue)  # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Experiment.objects.filter(change__abs=27)  # \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c # SELECT ... WHERE ABS(&quot;experiments&quot;.&quot;change&quot;) = 27 <\/code><\/pre>\n<h4>\u0414\u0440\u0443\u0433\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/h4>\n<p>  <b>django.contrib.admin<\/b>  <\/p>\n<ul>\n<li>\u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/contrib\/admin\/#django.contrib.admin.AdminSite.site_header\">\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435<\/a> site_header, site_title, \u0438 index_title, \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430.<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/contrib\/admin\/#django.contrib.admin.ModelAdmin.get_fields\">ModelAdmin.get_fields()<\/a> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d, \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 ModelAdmin.fields.<\/li>\n<li>\u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443 admin.site.register, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/contrib\/admin\/#django.contrib.admin.register\">\u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 register()<\/a>.<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/contrib\/admin\/#django.contrib.admin.ModelAdmin.list_display_links\">ModelAdmin.list_display_links<\/a> = None, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u044b \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 grid-\u0435<\/li>\n<li>\u0414\u043b\u044f \u043a\u043e\u0442\u0440\u043e\u043b\u044f \u043a\u043d\u043f\u043e\u043a\u0438 \u00ab\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435\u00bb, \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0432\u043e\u0439 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/contrib\/admin\/#django.contrib.admin.ModelAdmin.view_on_site\">ModelAdmin.view_on_site<\/a>.<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0443 \u0434\u043b\u044f <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/contrib\/admin\/#django.contrib.admin.ModelAdmin.list_display\">ModelAdmin.list_display<\/a>, \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0434\u0435\u0444\u0438\u0441 \u0432 admin_order_field.<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/contrib\/admin\/#django.contrib.admin.ModelAdmin.get_changeform_initial_data\">ModelAdmin.get_changeform_initial_data()<\/a> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d, \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u044b.<\/li>\n<\/ul>\n<p>  <b>django.contrib.auth<\/b>  <\/p>\n<ul>\n<li>**kwargs \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/contrib\/auth\/#django.contrib.auth.models.User.email_user\">email_user()<\/a>, \u0442\u0430\u043a \u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0438 \u0432 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/email\/#django.core.mail.send_mail\">send_mail()<\/a>.<\/li>\n<li>\u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/auth\/default\/#django.contrib.auth.decorators.permission_required\">permission_required()<\/a> \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0438\u043b\u0438 \u0436\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/li>\n<li>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/auth\/default\/#django.contrib.auth.forms.AuthenticationForm.confirm_login_allowed\">AuthenticationForm.confirm_login_allowed()<\/a>, \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u0438 \u043b\u0435\u0433\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/li>\n<li><a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/auth\/default\/#django.contrib.auth.views.password_reset\">django.contrib.auth.views.password_reset()<\/a> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 html_email_template_name. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 html \u043f\u0438\u0441\u0435\u043c, \u043f\u0440\u0438 \u0441\u0431\u0440\u043e\u0441\u0435 \u043f\u0430\u0440\u043e\u043b\u044f .<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/auth\/customizing\/#django.contrib.auth.models.AbstractBaseUser.get_session_auth_hash\">AbstractBaseUser.get_session_auth_hash()<\/a>. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0430 \u043e\u0442 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/auth\/customizing\/#django.contrib.auth.models.AbstractBaseUser\">AbstractBaseUser<\/a>, \u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0441\u0431\u0440\u043e\u0441\u0443 \u0435\u0433\u043e \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0445 \u0441\u0435\u0441\u0441\u0441\u0438\u0439.<\/li>\n<\/ul>\n<p>  <b>django.contrib.sites<\/b>  <\/p>\n<ul>\n<li>\u041d\u043e\u0432\u0430\u044f \u043c\u0438\u0434\u043b\u0432\u0430\u0440\u044c <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/middleware\/#django.contrib.sites.middleware.CurrentSiteMiddleware\">django.contrib.sites.middleware.CurrentSiteMiddleware<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0441\u0430\u0439\u0442 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435.<\/li>\n<\/ul>\n<p>  <b>E-mail<\/b>  <\/p>\n<ul>\n<li>\u0412 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/email\/#django.core.mail.send_mail\">send_mail()<\/a> \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 html_message, \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u0430 text\/html.<\/li>\n<li><a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/email\/#django.core.mail.backends.smtp.EmailBackend\">SMTP \u0431\u0435\u043a\u0435\u043d\u0434<\/a> \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/email\/#django.core.mail.backends.smtp.EmailBackend.timeout\">\u0442\u0430\u0439\u043c-\u0430\u0443\u0442\u0430<\/a>.<\/li>\n<\/ul>\n<p>  <b>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432<\/b>  <\/p>\n<ul>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/files\/uploads\/#django.core.files.uploadedfile.UploadedFile.content_type_extra\">UploadedFile.content_type_extra<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a\u0435 \u0442\u0438\u043f\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0444\u0430\u0439\u043b\u043e\u0432.<\/li>\n<li>\u041d\u043e\u0432\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/settings\/#std:setting-FILE_UPLOAD_DIRECTORY_PERMISSIONS\">FILE_UPLOAD_DIRECTORY_PERMISSIONS<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0444\u0430\u0439\u043b\u043e\u0432. \u0422\u0443 \u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/settings\/#std:setting-FILE_UPLOAD_PERMISSIONS\">FILE_UPLOAD_PERMISSIONS<\/a>.<\/li>\n<li><a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/models\/fields\/#django.db.models.FileField.upload_to\">FileField.upload_to<\/a> \u0442\u0435\u043f\u0435\u0440\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c.<\/li>\n<\/ul>\n<p>  <b>\u0424\u043e\u0440\u043c\u044b<\/b>  <\/p>\n<ul>\n<li>Textarea \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 max_length, \u0435\u0441\u043b\u0438 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d max_length.<\/li>\n<li>Field.choices \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0442\u044c value \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e &quot;&#8212;&#8212;-&quot;.<\/li>\n<li>\u0412 \u0444\u043e\u0440\u043c\u0430\u0445 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 clean() \u0431\u043e\u043b\u0435\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c self.cleaned_data.<\/li>\n<li>\u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u044f \u0438\u0437 \u0444\u043e\u0440\u043c\u044b, \u043f\u0443\u0442\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u0445 \u0438\u043c\u0435\u043d\u0438 \u0432 None.<\/li>\n<li>\u041d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 add_error() \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439.<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043a \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u0435\u043b\u044f\u043c \u0432\u0438\u0434\u0430 unique, unique_for_date, \u0438 unique_together.<\/li>\n<\/ul>\n<p>  <b>\u0418\u043d\u0442\u0435\u0440\u043d\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b>  <\/p>\n<ul>\n<li>\u0410\u0442\u0440\u0438\u0431\u0443\u0442 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/middleware\/#django.middleware.locale.LocaleMiddleware.response_redirect_class\">django.middleware.locale.LocaleMiddleware.response_redirect_class<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e.<\/li>\n<li><a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/middleware\/#django.middleware.locale.LocaleMiddleware\">LocaleMiddleware<\/a> \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u044f\u0437\u044b\u043a \u0432 _language. \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 LANGUAGE_SESSION_KEY.<\/li>\n<li>\u0422\u0435\u0433 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/i18n\/translation\/#std:templatetag-blocktrans\">blocktrans<\/a> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 trimmed. \u0414\u0430\u043d\u043d\u0430\u044f \u043e\u043f\u0446\u0438\u044f \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u0434\u043e \u043a\u043e\u043d\u0446\u0430, \u043e\u0431\u044c\u0435\u0434\u0435\u043d\u044f\u044f \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b. \u0427\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u043b\u043e\u043a\u0430\u043b\u0438.<\/li>\n<li>\u0423\u043b\u0443\u0447\u0448\u0435\u043d <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/django-admin\/#django-admin-makemessages\">makemessages<\/a>. <\/li>\n<li>\u0411\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u0449\u0438\u0435 \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b: LANGUAGE_COOKIE_AGE, LANGUAGE_COOKIE_DOMAIN and LANGUAGE_COOKIE_PATH.<\/li>\n<\/ul>\n<p>  <b>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/b>  <\/p>\n<ul>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0446\u0432\u0435\u0442\u043d\u043e\u0439 \u0432\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043c\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c\u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438 \u043f\u0440\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/li>\n<li>\u041d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u0435\u0448 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 createcachetable. \u0422\u0435\u043f\u0435\u0440\u044c Django \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0430\u043c\u0430, \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u0435\u0448\u0430 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/li>\n<li>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 runserver \u0431\u044b\u043b\u0430 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c pyinotify, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0435\u043b\u043e\u0430\u0434\u0430 \u0441\u0442\u0430\u043b\u0430 \u0432\u044b\u0448\u0435, \u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 \u0431\u0430\u0442\u0430\u0440\u0435\u044e \u043d\u0430 \u043d\u043e\u0443\u0442\u0430\u0445. \u0422\u0430\u043a \u0436\u0435 \u0441\u0435\u0440\u0432\u0435\u0440 \u0440\u0435\u043b\u043e\u0430\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b compilemessages. \u0412\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0441\u0442\u0430\u0442\u0438\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0436\u0434\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c.<\/li>\n<\/ul>\n<p>  <b>\u041c\u043e\u0434\u0435\u043b\u0438<\/b>  <\/p>\n<ul>\n<li>\u041d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/models\/querysets\/#django.db.models.query.QuerySet.update_or_create\">QuerySet.update_or_create()<\/a>.<\/li>\n<li>\u041d\u043e\u0432\u0430\u044f Meta \u043e\u043f\u0446\u0438\u044f <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/models\/options\/#django.db.models.Options.default_permissions\">default_permissions<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\/\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f.<\/li>\n<li>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 OneToOneField \u043f\u0440\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u0432 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445.<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c None \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/models\/querysets\/#std:fieldlookup-iexact\">iexact<\/a>.<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0434\u0438\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043e\u043a\u0430 \u0432 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/models\/options\/#django.db.models.Options.index_together\">index_together<\/a> \u043f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u043e\u043b\u0435\u0439(\u043d\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0432 \u0441\u043f\u0438\u0441\u043a\u0430\u0445).<\/li>\n<li>\u0427\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0411\u0414. \u0420\u0430\u043d\u0435\u0435 \u043c\u043e\u0433\u043b\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u043e\u0448\u0438\u0431\u043a\u0435.<\/li>\n<\/ul>\n<p>  <b>\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043e\u0442\u0432\u0435\u0442\u044b<\/b>  <\/p>\n<ul>\n<li>\u041d\u043e\u0432\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/request-response\/#django.http.HttpRequest.scheme\">HttpRequest.scheme<\/a> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0445\u0435\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (http \u0438\u043b\u0438 https).<\/li>\n<li><a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/topics\/http\/shortcuts\/#django.shortcuts.redirect\">redirect()<\/a> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 URL.<\/li>\n<li>\u041d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441 HttpResponse \u2014 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/request-response\/#django.http.JsonResponse\">JsonResponse<\/a>.<\/li>\n<\/ul>\n<p>  <b>\u0423\u0442\u0438\u043b\u0438\u0442\u044b<\/b>  <\/p>\n<ul>\n<li>\u0423\u043b\u0443\u0447\u0448\u0435\u043d <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/ref\/utils\/#django.utils.html.strip_tags\">strip_tags()<\/a>.<\/li>\n<\/ul>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0441\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0435\u0439\u0441\u044f \u0432 \u0441\u0442\u0430\u0434\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0438 \u043d\u043e\u0441\u0438\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440. <br \/>  \u0412 \u043d\u0435\u0433\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0430 \u043f\u043e\u0441\u0442\u0430. \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u0438 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044f, \u043c\u043e\u0436\u043d\u043e <br \/>  \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <a href=\"https:\/\/docs.djangoproject.com\/en\/dev\/releases\/1.7\/\">\u0434\u043e\u043a\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.    \t\t\t\t<\/p>\n<div class=\"polling\">\n<form action=\"\/json\/polling\/\" class=\"poll\" method=\"post\">\n<div class=\"poll_title\">\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b \u0440\u0435\u043b\u0438\u0437\u0430?<\/div>\n<p>  \t\t<input type=\"hidden\" name=\"post_id\" value=\"224249\"\/> \t\t<input type=\"hidden\" name=\"polling_question_id\" value=\"11239\"\/>  \t\t<\/p>\n<table class=\"answer\">\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv56701\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"56701\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv56701\">\u0414\u0430<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv56703\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"56703\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv56703\">\u041d\u0435\u0442<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv56705\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"56705\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv56705\">\u041c\u043d\u0435 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv56707\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"56707\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv56707\">\u0423\u0436\u0435 \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c<\/label> \t\t\t\t<\/td>\n<\/tr>\n<\/table>\n<p class=\"for_users_only_msg\">\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a href=\"https:\/\/habrahabr.ru\/auth\/login\/\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/p>\n<p class=\"total\">\u041d\u0438\u043a\u0442\u043e \u0435\u0449\u0451 \u043d\u0435 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b. \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0435\u0442.<\/p>\n<\/p><\/form>\n<\/p><\/div>\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\/224249\/\"> http:\/\/habrahabr.ru\/post\/224249\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043e\u0431\u0437\u043e\u0440 \u043d\u043e\u0432\u0448\u0435\u0441\u0442\u0432 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0438 Python \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Django 1.7. \u0420\u0435\u043b\u0438\u0437 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c, \u0442\u0430\u043a \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u2014 \u043a\u0430\u043a \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0439 \u0440\u0435\u043b\u0438\u0437, \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0445\u043e\u0434\u0430 \u0432 \u0441\u0432\u0435\u0442 Django 1.0.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/37e\/465\/2cc\/37e4652cc459cf199d92030a0887268e.jpg\" alt=\"image\"\/>  <\/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-224249","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/224249","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=224249"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/224249\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=224249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=224249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=224249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}