How do you model this in django? -


Considering square model as follows:

How do you do this Models.py?

  in class houses (models.Model): foo = models.CharField (max_length = 123) class.model: foo = models.CharField (max_length = 123  

But these foreign key: model.odel (models.Model): bar = models.CharField (max_length = 123) home = models.ForeignKey (house) caravan = models. ForeignKey (caravan) Definitions of purpose How do you code it in the Django? Its intention is to reuse the same model "door" for both "house" and "caravan".

After digging deep, I Found this; is this problem Model: Fu = Model Cheerfield (max_long = 123) Class caravan (model model): foo = Model CharField (Max_length = 123) class door (models.Model): bar = models.CharField (max_length = 123) home = models.ForeignKey (home, zero = true, empty = true) caravan = models.ForeignKey (caravan, void = true , Empty = true)

square-door (models.model): bar = Model .carfield (max_long = 123) class caravan (models.model): foo = models.CharField (max_length = 123) Door = Models: ManyToManyField classrooms (models.Model): foo = models.CharField (Max_length = 123) Doors = Model. Many accessories (doors)

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -