diff options
| author | django-bot <ops@djangoproject.com> | 2022-02-03 20:24:19 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-02-07 20:37:05 +0100 |
| commit | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 (patch) | |
| tree | f0506b668a013d0063e5fba3dbf4863b466713ba /tests/generic_inline_admin/models.py | |
| parent | f68fa8b45dfac545cfc4111d4e52804c86db68d3 (diff) | |
Refs #33476 -- Reformatted code with Black.
Diffstat (limited to 'tests/generic_inline_admin/models.py')
| -rw-r--r-- | tests/generic_inline_admin/models.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/generic_inline_admin/models.py b/tests/generic_inline_admin/models.py index 96cb6fb5a3..fa1b64d948 100644 --- a/tests/generic_inline_admin/models.py +++ b/tests/generic_inline_admin/models.py @@ -1,6 +1,4 @@ -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.db import models @@ -15,6 +13,7 @@ class Media(models.Model): """ Media that can associated to any object. """ + content_type = models.ForeignKey(ContentType, models.CASCADE) object_id = models.PositiveIntegerField() content_object = GenericForeignKey() @@ -36,17 +35,23 @@ class Category(models.Model): class PhoneNumber(models.Model): content_type = models.ForeignKey(ContentType, models.CASCADE) object_id = models.PositiveIntegerField() - content_object = GenericForeignKey('content_type', 'object_id') + content_object = GenericForeignKey("content_type", "object_id") phone_number = models.CharField(max_length=30) category = models.ForeignKey(Category, models.SET_NULL, null=True, blank=True) class Meta: - unique_together = (('content_type', 'object_id', 'phone_number',),) + unique_together = ( + ( + "content_type", + "object_id", + "phone_number", + ), + ) class Contact(models.Model): name = models.CharField(max_length=50) - phone_numbers = GenericRelation(PhoneNumber, related_query_name='phone_numbers') + phone_numbers = GenericRelation(PhoneNumber, related_query_name="phone_numbers") # |
