1
0
mirror of https://github.com/django/django.git synced 2025-01-05 16:06:07 +00:00
django/tests/test_utils/models.py
Mariusz Felisiak b330b918e9
Removed unused and incorrect PossessedCar.__str__() method in test_utils.
PossessedCar doesn't have a color.
2020-02-14 13:16:17 +01:00

22 lines
479 B
Python

from django.db import models
class Car(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Person(models.Model):
name = models.CharField(max_length=100)
cars = models.ManyToManyField(Car, through='PossessedCar')
def __str__(self):
return self.name
class PossessedCar(models.Model):
car = models.ForeignKey(Car, models.CASCADE)
belongs_to = models.ForeignKey(Person, models.CASCADE)