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
@@ -24,10 +24,10 @@ class CommonInfo(models.Model):
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
ordering = ['name']
|
||||
ordering = ["name"]
|
||||
|
||||
def __str__(self):
|
||||
return '%s %s' % (self.__class__.__name__, self.name)
|
||||
return "%s %s" % (self.__class__.__name__, self.name)
|
||||
|
||||
|
||||
class Worker(CommonInfo):
|
||||
@@ -45,6 +45,7 @@ class Student(CommonInfo):
|
||||
# Abstract base classes with related models
|
||||
#
|
||||
|
||||
|
||||
class Post(models.Model):
|
||||
title = models.CharField(max_length=50)
|
||||
|
||||
@@ -53,8 +54,8 @@ class Attachment(models.Model):
|
||||
post = models.ForeignKey(
|
||||
Post,
|
||||
models.CASCADE,
|
||||
related_name='attached_%(class)s_set',
|
||||
related_query_name='attached_%(app_label)s_%(class)ss',
|
||||
related_name="attached_%(class)s_set",
|
||||
related_query_name="attached_%(app_label)s_%(class)ss",
|
||||
)
|
||||
content = models.TextField()
|
||||
|
||||
@@ -74,6 +75,7 @@ class Link(Attachment):
|
||||
# Multi-table inheritance
|
||||
#
|
||||
|
||||
|
||||
class Chef(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
@@ -88,7 +90,7 @@ class Rating(models.Model):
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
ordering = ['-rating']
|
||||
ordering = ["-rating"]
|
||||
|
||||
|
||||
class Restaurant(Place, Rating):
|
||||
@@ -97,7 +99,7 @@ class Restaurant(Place, Rating):
|
||||
chef = models.ForeignKey(Chef, models.SET_NULL, null=True, blank=True)
|
||||
|
||||
class Meta(Rating.Meta):
|
||||
db_table = 'my_restaurant'
|
||||
db_table = "my_restaurant"
|
||||
|
||||
|
||||
class ItalianRestaurant(Restaurant):
|
||||
@@ -105,13 +107,15 @@ class ItalianRestaurant(Restaurant):
|
||||
|
||||
|
||||
class Supplier(Place):
|
||||
customers = models.ManyToManyField(Restaurant, related_name='provider')
|
||||
customers = models.ManyToManyField(Restaurant, related_name="provider")
|
||||
|
||||
|
||||
class ParkingLot(Place):
|
||||
# An explicit link to the parent (we can control the attribute name).
|
||||
parent = models.OneToOneField(Place, models.CASCADE, primary_key=True, parent_link=True)
|
||||
main_site = models.ForeignKey(Place, models.CASCADE, related_name='lot')
|
||||
parent = models.OneToOneField(
|
||||
Place, models.CASCADE, primary_key=True, parent_link=True
|
||||
)
|
||||
main_site = models.ForeignKey(Place, models.CASCADE, related_name="lot")
|
||||
|
||||
|
||||
#
|
||||
@@ -123,12 +127,15 @@ class ParkingLot(Place):
|
||||
# here in order to have the name conflict between apps
|
||||
#
|
||||
|
||||
|
||||
class Title(models.Model):
|
||||
title = models.CharField(max_length=50)
|
||||
|
||||
|
||||
class NamedURL(models.Model):
|
||||
title = models.ForeignKey(Title, models.CASCADE, related_name='attached_%(app_label)s_%(class)s_set')
|
||||
title = models.ForeignKey(
|
||||
Title, models.CASCADE, related_name="attached_%(app_label)s_%(class)s_set"
|
||||
)
|
||||
url = models.URLField()
|
||||
|
||||
class Meta:
|
||||
@@ -157,12 +164,12 @@ class GrandParent(models.Model):
|
||||
first_name = models.CharField(max_length=80)
|
||||
last_name = models.CharField(max_length=80)
|
||||
email = models.EmailField(unique=True)
|
||||
place = models.ForeignKey(Place, models.CASCADE, null=True, related_name='+')
|
||||
place = models.ForeignKey(Place, models.CASCADE, null=True, related_name="+")
|
||||
|
||||
class Meta:
|
||||
# Ordering used by test_inherited_ordering_pk_desc.
|
||||
ordering = ['-pk']
|
||||
unique_together = ('first_name', 'last_name')
|
||||
ordering = ["-pk"]
|
||||
unique_together = ("first_name", "last_name")
|
||||
|
||||
|
||||
class Parent(GrandParent):
|
||||
|
||||
Reference in New Issue
Block a user