2010-10-12 03:33:19 +00:00
|
|
|
from django.db import models
|
|
|
|
|
2014-09-30 13:24:20 -04:00
|
|
|
|
2014-09-29 17:17:44 +02:00
|
|
|
class Car(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
2014-09-30 13:24:20 -04:00
|
|
|
|
2010-10-12 03:33:19 +00:00
|
|
|
class Person(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
2014-09-29 17:17:44 +02:00
|
|
|
cars = models.ManyToManyField(Car, through="PossessedCar")
|
2021-12-03 11:56:22 +01:00
|
|
|
data = models.BinaryField(null=True)
|
2012-12-13 13:33:11 +02:00
|
|
|
|
2014-09-30 13:24:20 -04:00
|
|
|
|
2014-09-29 17:17:44 +02:00
|
|
|
class PossessedCar(models.Model):
|
2015-07-22 09:43:21 -05:00
|
|
|
car = models.ForeignKey(Car, models.CASCADE)
|
2018-11-23 21:22:09 -05:00
|
|
|
belongs_to = models.ForeignKey(
|
|
|
|
Person, models.CASCADE, related_name="possessed_cars"
|
|
|
|
)
|