#django #orm Relationships Cheat Sheet
▻https://hackernoon.com/django-orm-relationships-cheat-sheet-14433d6cf68c?source=rss----3a8144ea
Credits — author : Jez Timms; illustrator : Tatuna GverdtsiteliA cheat sheet for Django ORM relationships — version 2.1I want to start this story with saying thanks to Mahmoud Zalt, who published a really useful article “Eloquent Relationships Cheat Sheet” about a year ago and also gave me permission to use the same structure/images/examples in my article.One to One RelationshipOne to Many RelationshipMany to Many RelationshipPolymorphic One to Many Relationship — Generic RelationsPolymorphic One to Many Relationship — django-polymorphic packagePolymorphic Many to Many Relationship — django-polymorphic packageOne to One RelationshipDemo details:In this demo we have 2 models (Owner and Car), and 2 tables (owners and cars).Business Rules:The Owner can own one Car.The Car can be owned by one Owner.Relations (...)