I have a Person model:
class Person(models.Model):
name = models.CharField(max_length=100)
And then a Car model:
class Car(models.Model):
plate = models.CharField(max_lenght=100)
owner = models.ForeignKey(Person)
And then a certain CarAttribute model:
class CarAttribute(models.Model):
whatever = models.CharField(max_lenght=100)
car = models.ForeignKey(Car)
Person has a relation 1 to many to Car. Car has a relation 1 to many to Car attributre.
Is there a way in Django for adding the Car (and eventually its relative CarAttributes) in the Form to be used when adding a new Person? One person may have more than one car, and one car can multiple attributes.
Any hints on how to approach this solution with Django? Or complementary tool?
Aucun commentaire:
Enregistrer un commentaire