1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Refs #33476 -- Reformatted code with Black.

This commit is contained in:
django-bot
2022-02-03 20:24:19 +01:00
committed by Mariusz Felisiak
parent f68fa8b45d
commit 9c19aff7c7
1992 changed files with 139577 additions and 96284 deletions

View File

@@ -11,7 +11,9 @@ class MyFileField(models.FileField):
class Member(models.Model):
name = models.CharField(max_length=100)
birthdate = models.DateTimeField(blank=True, null=True)
gender = models.CharField(max_length=1, blank=True, choices=[('M', 'Male'), ('F', 'Female')])
gender = models.CharField(
max_length=1, blank=True, choices=[("M", "Male"), ("F", "Female")]
)
email = models.EmailField(blank=True)
def __str__(self):
@@ -36,16 +38,16 @@ class UnsafeLimitChoicesTo(models.Model):
band = models.ForeignKey(
Band,
models.CASCADE,
limit_choices_to={'name': '"&><escapeme'},
limit_choices_to={"name": '"&><escapeme'},
)
class Album(models.Model):
band = models.ForeignKey(Band, models.CASCADE, to_field='uuid')
featuring = models.ManyToManyField(Band, related_name='featured')
band = models.ForeignKey(Band, models.CASCADE, to_field="uuid")
featuring = models.ManyToManyField(Band, related_name="featured")
name = models.CharField(max_length=100)
cover_art = models.FileField(upload_to='albums')
backside_art = MyFileField(upload_to='albums_back', null=True)
cover_art = models.FileField(upload_to="albums")
backside_art = MyFileField(upload_to="albums_back", null=True)
def __str__(self):
return self.name
@@ -56,11 +58,12 @@ class ReleaseEvent(models.Model):
Used to check that autocomplete widget correctly resolves attname for FK as
PK example.
"""
album = models.ForeignKey(Album, models.CASCADE, primary_key=True)
name = models.CharField(max_length=100)
class Meta:
ordering = ['name']
ordering = ["name"]
def __str__(self):
return self.name
@@ -77,7 +80,9 @@ class HiddenInventoryManager(models.Manager):
class Inventory(models.Model):
barcode = models.PositiveIntegerField(unique=True)
parent = models.ForeignKey('self', models.SET_NULL, to_field='barcode', blank=True, null=True)
parent = models.ForeignKey(
"self", models.SET_NULL, to_field="barcode", blank=True, null=True
)
name = models.CharField(blank=False, max_length=20)
hidden = models.BooleanField(default=False)
@@ -94,13 +99,13 @@ class Event(models.Model):
Band,
models.CASCADE,
limit_choices_to=models.Q(pk__gt=0),
related_name='events_main_band_at',
related_name="events_main_band_at",
)
supporting_bands = models.ManyToManyField(
Band,
blank=True,
related_name='events_supporting_band_at',
help_text='Supporting Bands.',
related_name="events_supporting_band_at",
help_text="Supporting Bands.",
)
start_date = models.DateField(blank=True, null=True)
start_time = models.TimeField(blank=True, null=True)
@@ -122,6 +127,7 @@ class CarTire(models.Model):
"""
A single car tire. This to test that a user can only select their own cars.
"""
car = models.ForeignKey(Car, models.CASCADE)
@@ -136,6 +142,7 @@ class Bee(models.Model):
(Honeycomb) so the corresponding raw ID widget won't have a magnifying
glass link to select related honeycomb instances.
"""
honeycomb = models.ForeignKey(Honeycomb, models.CASCADE)
@@ -145,9 +152,12 @@ class Individual(models.Model):
corresponding raw ID widget won't have a magnifying glass link to select
related instances (rendering will be called programmatically in this case).
"""
name = models.CharField(max_length=20)
parent = models.ForeignKey('self', models.SET_NULL, null=True)
soulmate = models.ForeignKey('self', models.CASCADE, null=True, related_name='soulmates')
parent = models.ForeignKey("self", models.SET_NULL, null=True)
soulmate = models.ForeignKey(
"self", models.CASCADE, null=True, related_name="soulmates"
)
class Company(models.Model):
@@ -160,6 +170,7 @@ class Advisor(models.Model):
(Company) so the corresponding raw ID widget won't have a magnifying
glass link to select related company instances.
"""
name = models.CharField(max_length=20)
companies = models.ManyToManyField(Company)
@@ -168,7 +179,7 @@ class Student(models.Model):
name = models.CharField(max_length=255)
class Meta:
ordering = ('name',)
ordering = ("name",)
def __str__(self):
return self.name
@@ -176,15 +187,15 @@ class Student(models.Model):
class School(models.Model):
name = models.CharField(max_length=255)
students = models.ManyToManyField(Student, related_name='current_schools')
alumni = models.ManyToManyField(Student, related_name='previous_schools')
students = models.ManyToManyField(Student, related_name="current_schools")
alumni = models.ManyToManyField(Student, related_name="previous_schools")
def __str__(self):
return self.name
class Profile(models.Model):
user = models.ForeignKey('auth.User', models.CASCADE, to_field='username')
user = models.ForeignKey("auth.User", models.CASCADE, to_field="username")
def __str__(self):
return self.user.username