From bd01cb9750e4bdf3a99a823712b21f7f0adf2e2d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:10:25 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20[pre-commit.ci]=20Auto=20format?= =?UTF-8?q?=20from=20pre-commit.com=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../polls/migrations/0001_initial.py | 46 +++++++++++++------ docs_src/django_orm/polls/models.py | 8 ++-- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/docs_src/django_orm/polls/migrations/0001_initial.py b/docs_src/django_orm/polls/migrations/0001_initial.py index 9d6420237..ee462a84f 100644 --- a/docs_src/django_orm/polls/migrations/0001_initial.py +++ b/docs_src/django_orm/polls/migrations/0001_initial.py @@ -1,36 +1,52 @@ # Generated by Django 2.1 on 2018-08-08 21:45 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): - initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Choice', + name="Choice", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('choice_text', models.CharField(max_length=200)), - ('votes', models.IntegerField(default=0)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("choice_text", models.CharField(max_length=200)), + ("votes", models.IntegerField(default=0)), ], ), migrations.CreateModel( - name='Question', + name="Question", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('question_text', models.CharField(max_length=200)), - ('pub_date', models.DateTimeField(verbose_name='date published')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("question_text", models.CharField(max_length=200)), + ("pub_date", models.DateTimeField(verbose_name="date published")), ], ), migrations.AddField( - model_name='choice', - name='question', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='polls.Question'), + model_name="choice", + name="question", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="polls.Question" + ), ), ] diff --git a/docs_src/django_orm/polls/models.py b/docs_src/django_orm/polls/models.py index 70f5466a0..a0639e46c 100644 --- a/docs_src/django_orm/polls/models.py +++ b/docs_src/django_orm/polls/models.py @@ -6,7 +6,7 @@ from django.utils import timezone class Question(models.Model): question_text = models.CharField(max_length=200) - pub_date = models.DateTimeField('date published') + pub_date = models.DateTimeField("date published") def __str__(self): return self.question_text @@ -14,10 +14,10 @@ class Question(models.Model): def was_published_recently(self): now = timezone.now() return now - datetime.timedelta(days=1) <= self.pub_date <= now - - was_published_recently.admin_order_field = 'pub_date' + + was_published_recently.admin_order_field = "pub_date" was_published_recently.boolean = True - was_published_recently.short_description = 'Published recently?' + was_published_recently.short_description = "Published recently?" class Choice(models.Model):