mirror of
https://github.com/django/django.git
synced 2025-11-01 12:25:37 +00:00
PEP8 cleanup
Signed-off-by: Jason Myers <jason@jasonamyers.com>
This commit is contained in:
parent
0fdb692c6c
commit
7a61c68c50
128 changed files with 739 additions and 206 deletions
|
|
@ -8,6 +8,7 @@ from django.utils.encoding import python_2_unicode_compatible
|
|||
class MyFileField(models.FileField):
|
||||
pass
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Member(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
|
@ -18,6 +19,7 @@ class Member(models.Model):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Band(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
|
@ -27,6 +29,7 @@ class Band(models.Model):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Album(models.Model):
|
||||
band = models.ForeignKey(Band)
|
||||
|
|
@ -37,10 +40,12 @@ class Album(models.Model):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class HiddenInventoryManager(models.Manager):
|
||||
def get_queryset(self):
|
||||
return super(HiddenInventoryManager, self).get_queryset().filter(hidden=False)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Inventory(models.Model):
|
||||
barcode = models.PositiveIntegerField(unique=True)
|
||||
|
|
@ -55,6 +60,7 @@ class Inventory(models.Model):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Event(models.Model):
|
||||
main_band = models.ForeignKey(Band, limit_choices_to=models.Q(pk__gt=0), related_name='events_main_band_at')
|
||||
supporting_bands = models.ManyToManyField(Band, null=True, blank=True, related_name='events_supporting_band_at')
|
||||
|
|
@ -64,6 +70,7 @@ class Event(models.Model):
|
|||
link = models.URLField(blank=True)
|
||||
min_age = models.IntegerField(blank=True, null=True)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Car(models.Model):
|
||||
owner = models.ForeignKey(User)
|
||||
|
|
@ -73,15 +80,18 @@ class Car(models.Model):
|
|||
def __str__(self):
|
||||
return "%s %s" % (self.make, self.model)
|
||||
|
||||
|
||||
class CarTire(models.Model):
|
||||
"""
|
||||
A single car tire. This to test that a user can only select their own cars.
|
||||
"""
|
||||
car = models.ForeignKey(Car)
|
||||
|
||||
|
||||
class Honeycomb(models.Model):
|
||||
location = models.CharField(max_length=20)
|
||||
|
||||
|
||||
class Bee(models.Model):
|
||||
"""
|
||||
A model with a FK to a model that won't be registered with the admin
|
||||
|
|
@ -90,6 +100,7 @@ class Bee(models.Model):
|
|||
"""
|
||||
honeycomb = models.ForeignKey(Honeycomb)
|
||||
|
||||
|
||||
class Individual(models.Model):
|
||||
"""
|
||||
A model with a FK to itself. It won't be registered with the admin, so the
|
||||
|
|
@ -99,9 +110,11 @@ class Individual(models.Model):
|
|||
name = models.CharField(max_length=20)
|
||||
parent = models.ForeignKey('self', null=True)
|
||||
|
||||
|
||||
class Company(models.Model):
|
||||
name = models.CharField(max_length=20)
|
||||
|
||||
|
||||
class Advisor(models.Model):
|
||||
"""
|
||||
A model with a m2m to a model that won't be registered with the admin
|
||||
|
|
@ -122,6 +135,7 @@ class Student(models.Model):
|
|||
class Meta:
|
||||
ordering = ('name',)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class School(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue