diff options
| author | django-bot <ops@djangoproject.com> | 2022-02-08 12:09:55 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-02-08 12:15:38 +0100 |
| commit | 6a682b38e75d4c975b4c4493565a59f1bc14397c (patch) | |
| tree | 0bd9cda550bea26238656d9f120d769e8b41bb9e /tests/contenttypes_tests/models.py | |
| parent | e73ce08888e6f34d3f050377cfd2fbb733be94a9 (diff) | |
[4.0.x] Refs #33476 -- Reformatted code with Black.
Backport of 9c19aff7c7561e3a82978a272ecdaad40dda5c00 from main.
Diffstat (limited to 'tests/contenttypes_tests/models.py')
| -rw-r--r-- | tests/contenttypes_tests/models.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/contenttypes_tests/models.py b/tests/contenttypes_tests/models.py index 2e0640459f..5e40217c30 100644 --- a/tests/contenttypes_tests/models.py +++ b/tests/contenttypes_tests/models.py @@ -1,8 +1,6 @@ from urllib.parse import quote -from django.contrib.contenttypes.fields import ( - GenericForeignKey, GenericRelation, -) +from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import SiteManager from django.db import models @@ -17,7 +15,7 @@ class Author(models.Model): name = models.CharField(max_length=100) def get_absolute_url(self): - return '/authors/%s/' % self.id + return "/authors/%s/" % self.id class Article(models.Model): @@ -48,6 +46,7 @@ class FooWithoutUrl(models.Model): Fake model not defining ``get_absolute_url`` for ContentTypesTests.test_shortcut_view_without_get_absolute_url() """ + name = models.CharField(max_length=30, unique=True) @@ -72,7 +71,7 @@ class FooWithBrokenAbsoluteUrl(FooWithoutUrl): class Question(models.Model): text = models.CharField(max_length=200) - answer_set = GenericRelation('Answer') + answer_set = GenericRelation("Answer") class Answer(models.Model): @@ -82,19 +81,20 @@ class Answer(models.Model): question = GenericForeignKey() class Meta: - order_with_respect_to = 'question' + order_with_respect_to = "question" class Post(models.Model): """An ordered tag on an item.""" + title = models.CharField(max_length=200) content_type = models.ForeignKey(ContentType, models.CASCADE, null=True) object_id = models.PositiveIntegerField(null=True) parent = GenericForeignKey() - children = GenericRelation('Post') + children = GenericRelation("Post") class Meta: - order_with_respect_to = 'parent' + order_with_respect_to = "parent" class ModelWithNullFKToSite(models.Model): @@ -103,7 +103,7 @@ class ModelWithNullFKToSite(models.Model): post = models.ForeignKey(Post, null=True, on_delete=models.CASCADE) def get_absolute_url(self): - return '/title/%s/' % quote(self.title) + return "/title/%s/" % quote(self.title) class ModelWithM2MToSite(models.Model): @@ -111,4 +111,4 @@ class ModelWithM2MToSite(models.Model): sites = models.ManyToManyField(Site) def get_absolute_url(self): - return '/title/%s/' % quote(self.title) + return "/title/%s/" % quote(self.title) |
