{"repo":"django-commons/django-polymorphic","free":true,"listed":false,"github":"https://github.com/django-commons/django-polymorphic","clone":"git clone https://github.com/django-commons/django-polymorphic.git","description":"Improved Django model inheritance with automatic downcasting","language":"Python","stars":1833,"topics":["django","django-orm","django-admin","django-formsets","object-oriented","oop","polymorphism"],"license":null,"category":"api-integrations-sdks","readme_excerpt":"django-polymorphic --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- Polymorphic Models for Django django-polymorphic simplifies using inherited models in Django projects. When a query is made at the base model, the inherited model classes are returned. When we store models that inherit from a Project model... ...and want to retrieve all our projects, the subclassed models are returned! Using vanilla Django, we get the base class objects, which is rarely what we wanted: This also works when the polymorphic model is accessed via ForeignKeys, ManyToManyFields or OneToOneFields. Features Full admin integration. ORM integration: support for ForeignKey, ManyToManyField, OneToOneField descriptors. Filtering/ordering of inherited models ( ArtProject artist ). Filtering model types: instance of(...) and not instance of(...) Combining querysets of different models ( qs3 = qs1 qs2 ) Support for custom user-defined managers. Uses the minimum amount of queries needed to fetch the inherited models. Disabling polymorphic behavior when needed. Note: While django-polymorphic makes subclassed models easy to use in Django, we still encourage to use them with caution. Each subclassed model will require Django to perform an INNER JOIN to fetch the model fields from the database. While taking this in mind, there are valid reasons for using subclasse","default_branch":null,"files":null,"tree":[],"storefront":"/r/django-commons","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/django-commons/django-polymorphic/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}