Browse Source

🎨 [pre-commit.ci] Auto format from pre-commit.com hooks

pull/11782/head
pre-commit-ci[bot] 1 year ago
committed by Patrick Arminio
parent
commit
bd01cb9750
Failed to extract signature
  1. 46
      docs_src/django_orm/polls/migrations/0001_initial.py
  2. 6
      docs_src/django_orm/polls/models.py

46
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"
),
),
]

6
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
@ -15,9 +15,9 @@ class Question(models.Model):
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):

Loading…
Cancel
Save