mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixing E302 Errors
Signed-off-by: Jason Myers <jason@jasonamyers.com>
This commit is contained in:
parent
2a03a9a9a1
commit
c3791463a5
98 changed files with 748 additions and 96 deletions
|
@ -11,6 +11,7 @@ class Building(models.Model):
|
|||
def __str__(self):
|
||||
return "Building: %s" % self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Device(models.Model):
|
||||
building = models.ForeignKey('Building')
|
||||
|
@ -19,6 +20,7 @@ class Device(models.Model):
|
|||
def __str__(self):
|
||||
return "device '%s' in building %s" % (self.name, self.building)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Port(models.Model):
|
||||
device = models.ForeignKey('Device')
|
||||
|
@ -27,6 +29,7 @@ class Port(models.Model):
|
|||
def __str__(self):
|
||||
return "%s/%s" % (self.device.name, self.port_number)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Connection(models.Model):
|
||||
start = models.ForeignKey(Port, related_name='connection_start',
|
||||
|
@ -38,45 +41,60 @@ class Connection(models.Model):
|
|||
|
||||
# Another non-tree hierarchy that exercises code paths similar to the above
|
||||
# example, but in a slightly different configuration.
|
||||
|
||||
|
||||
class TUser(models.Model):
|
||||
name = models.CharField(max_length=200)
|
||||
|
||||
|
||||
class Person(models.Model):
|
||||
user = models.ForeignKey(TUser, unique=True)
|
||||
|
||||
|
||||
class Organizer(models.Model):
|
||||
person = models.ForeignKey(Person)
|
||||
|
||||
|
||||
class Student(models.Model):
|
||||
person = models.ForeignKey(Person)
|
||||
|
||||
|
||||
class Class(models.Model):
|
||||
org = models.ForeignKey(Organizer)
|
||||
|
||||
|
||||
class Enrollment(models.Model):
|
||||
std = models.ForeignKey(Student)
|
||||
cls = models.ForeignKey(Class)
|
||||
|
||||
# Models for testing bug #8036.
|
||||
|
||||
|
||||
class Country(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
|
||||
class State(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
country = models.ForeignKey(Country)
|
||||
|
||||
|
||||
class ClientStatus(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
|
||||
class Client(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
state = models.ForeignKey(State, null=True)
|
||||
status = models.ForeignKey(ClientStatus)
|
||||
|
||||
|
||||
class SpecialClient(Client):
|
||||
value = models.IntegerField()
|
||||
|
||||
# Some model inheritance exercises
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Parent(models.Model):
|
||||
name = models.CharField(max_length=10)
|
||||
|
@ -84,9 +102,11 @@ class Parent(models.Model):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Child(Parent):
|
||||
value = models.IntegerField()
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Item(models.Model):
|
||||
name = models.CharField(max_length=10)
|
||||
|
@ -96,6 +116,8 @@ class Item(models.Model):
|
|||
return self.name
|
||||
|
||||
# Models for testing bug #19870.
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Fowl(models.Model):
|
||||
name = models.CharField(max_length=10)
|
||||
|
@ -103,12 +125,15 @@ class Fowl(models.Model):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Hen(Fowl):
|
||||
pass
|
||||
|
||||
|
||||
class Chick(Fowl):
|
||||
mother = models.ForeignKey(Hen)
|
||||
|
||||
|
||||
class Base(models.Model):
|
||||
name = models.CharField(max_length=10)
|
||||
lots_of_text = models.TextField()
|
||||
|
@ -116,12 +141,15 @@ class Base(models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
class A(Base):
|
||||
a_field = models.CharField(max_length=10)
|
||||
|
||||
|
||||
class B(Base):
|
||||
b_field = models.CharField(max_length=10)
|
||||
|
||||
|
||||
class C(Base):
|
||||
c_a = models.ForeignKey(A)
|
||||
c_b = models.ForeignKey(B)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue