mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #33476 -- Reformatted code with Black.
This commit is contained in:
committed by
Mariusz Felisiak
parent
f68fa8b45d
commit
9c19aff7c7
@@ -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
|
||||
|
||||
@@ -18,7 +16,7 @@ class Person(models.Model):
|
||||
last_name = models.CharField(max_length=20)
|
||||
|
||||
def __str__(self):
|
||||
return '%s %s' % (self.first_name, self.last_name)
|
||||
return "%s %s" % (self.first_name, self.last_name)
|
||||
|
||||
|
||||
class SchoolClassManager(models.Manager):
|
||||
@@ -35,25 +33,33 @@ class SchoolClass(models.Model):
|
||||
|
||||
|
||||
class VeryLongModelNameZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ(models.Model):
|
||||
primary_key_is_quite_long_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz = models.AutoField(primary_key=True)
|
||||
charfield_is_quite_long_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz = models.CharField(max_length=100)
|
||||
m2m_also_quite_long_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz = models.ManyToManyField(Person, blank=True)
|
||||
primary_key_is_quite_long_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz = models.AutoField(
|
||||
primary_key=True
|
||||
)
|
||||
charfield_is_quite_long_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz = models.CharField(
|
||||
max_length=100
|
||||
)
|
||||
m2m_also_quite_long_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz = (
|
||||
models.ManyToManyField(Person, blank=True)
|
||||
)
|
||||
|
||||
|
||||
class Tag(models.Model):
|
||||
name = models.CharField(max_length=30)
|
||||
content_type = models.ForeignKey(ContentType, models.CASCADE, related_name='backend_tags')
|
||||
content_type = models.ForeignKey(
|
||||
ContentType, models.CASCADE, related_name="backend_tags"
|
||||
)
|
||||
object_id = models.PositiveIntegerField()
|
||||
content_object = GenericForeignKey('content_type', 'object_id')
|
||||
content_object = GenericForeignKey("content_type", "object_id")
|
||||
|
||||
|
||||
class Post(models.Model):
|
||||
name = models.CharField(max_length=30)
|
||||
text = models.TextField()
|
||||
tags = GenericRelation('Tag')
|
||||
tags = GenericRelation("Tag")
|
||||
|
||||
class Meta:
|
||||
db_table = 'CaseSensitive_Post'
|
||||
db_table = "CaseSensitive_Post"
|
||||
|
||||
|
||||
class Reporter(models.Model):
|
||||
@@ -77,7 +83,7 @@ class Article(models.Model):
|
||||
ReporterProxy,
|
||||
models.SET_NULL,
|
||||
null=True,
|
||||
related_name='reporter_proxy',
|
||||
related_name="reporter_proxy",
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
@@ -95,8 +101,10 @@ class Item(models.Model):
|
||||
|
||||
|
||||
class Object(models.Model):
|
||||
related_objects = models.ManyToManyField("self", db_constraint=False, symmetrical=False)
|
||||
obj_ref = models.ForeignKey('ObjectReference', models.CASCADE, null=True)
|
||||
related_objects = models.ManyToManyField(
|
||||
"self", db_constraint=False, symmetrical=False
|
||||
)
|
||||
obj_ref = models.ForeignKey("ObjectReference", models.CASCADE, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.id)
|
||||
@@ -111,12 +119,12 @@ class ObjectReference(models.Model):
|
||||
|
||||
class ObjectSelfReference(models.Model):
|
||||
key = models.CharField(max_length=3, unique=True)
|
||||
obj = models.ForeignKey('ObjectSelfReference', models.SET_NULL, null=True)
|
||||
obj = models.ForeignKey("ObjectSelfReference", models.SET_NULL, null=True)
|
||||
|
||||
|
||||
class CircularA(models.Model):
|
||||
key = models.CharField(max_length=3, unique=True)
|
||||
obj = models.ForeignKey('CircularB', models.SET_NULL, null=True)
|
||||
obj = models.ForeignKey("CircularB", models.SET_NULL, null=True)
|
||||
|
||||
def natural_key(self):
|
||||
return (self.key,)
|
||||
@@ -124,7 +132,7 @@ class CircularA(models.Model):
|
||||
|
||||
class CircularB(models.Model):
|
||||
key = models.CharField(max_length=3, unique=True)
|
||||
obj = models.ForeignKey('CircularA', models.SET_NULL, null=True)
|
||||
obj = models.ForeignKey("CircularA", models.SET_NULL, null=True)
|
||||
|
||||
def natural_key(self):
|
||||
return (self.key,)
|
||||
@@ -139,12 +147,12 @@ class Author(models.Model):
|
||||
|
||||
|
||||
class Book(models.Model):
|
||||
author = models.ForeignKey(Author, models.CASCADE, to_field='name')
|
||||
author = models.ForeignKey(Author, models.CASCADE, to_field="name")
|
||||
|
||||
|
||||
class SQLKeywordsModel(models.Model):
|
||||
id = models.AutoField(primary_key=True, db_column='select')
|
||||
reporter = models.ForeignKey(Reporter, models.CASCADE, db_column='where')
|
||||
id = models.AutoField(primary_key=True, db_column="select")
|
||||
reporter = models.ForeignKey(Reporter, models.CASCADE, db_column="where")
|
||||
|
||||
class Meta:
|
||||
db_table = 'order'
|
||||
db_table = "order"
|
||||
|
||||
Reference in New Issue
Block a user