[py3] Fixed __unicode__ methods missed in d4a0b278
due to non-standard syntax (a stray comma). Thanks dmishe for the report.
This commit is contained in:
parent
b1f18e95a5
commit
ad11dbf670
|
@ -60,22 +60,25 @@ class B(models.Model):
|
||||||
|
|
||||||
|
|
||||||
# Using to_field on the through model
|
# Using to_field on the through model
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Car(models.Model):
|
class Car(models.Model):
|
||||||
make = models.CharField(max_length=20, unique=True)
|
make = models.CharField(max_length=20, unique=True)
|
||||||
drivers = models.ManyToManyField('Driver', through='CarDriver')
|
drivers = models.ManyToManyField('Driver', through='CarDriver')
|
||||||
|
|
||||||
def __unicode__(self, ):
|
def __str__(self):
|
||||||
return self.make
|
return self.make
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Driver(models.Model):
|
class Driver(models.Model):
|
||||||
name = models.CharField(max_length=20, unique=True)
|
name = models.CharField(max_length=20, unique=True)
|
||||||
|
|
||||||
def __unicode__(self, ):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class CarDriver(models.Model):
|
class CarDriver(models.Model):
|
||||||
car = models.ForeignKey('Car', to_field='make')
|
car = models.ForeignKey('Car', to_field='make')
|
||||||
driver = models.ForeignKey('Driver', to_field='name')
|
driver = models.ForeignKey('Driver', to_field='name')
|
||||||
|
|
||||||
def __unicode__(self, ):
|
def __str__(self):
|
||||||
return "pk=%s car=%s driver=%s" % (str(self.pk), self.car, self.driver)
|
return "pk=%s car=%s driver=%s" % (str(self.pk), self.car, self.driver)
|
||||||
|
|
Loading…
Reference in New Issue