Features of django-polymorphic
maindjango-polymorphic provides several enhancements for working with inherited models:
ORM Integration
- Descriptor Support: Works with
ForeignKey,ManyToManyField, andOneToOneField. - Proxy Models: Supports Django proxy models.
- Filtering/Ordering: Allows filtering and ordering on inherited model fields using the
__syntax (e.g.,ArtProject___artist). - Type Filtering: Provides methods to filter by specific model types using
instance_ofandnot_instance_ofon thePolymorphicQuerySet. - Queryset Composition: Supports combining querysets from different models using the OR operator (
qs1 | qs2). - Custom Managers: Supports user-defined managers.
Other Features
- Admin Integration: Full support for the Django admin interface.
- Formsets: Built-in support for polymorphic formsets.
- Performance: Optimized to use the minimum number of queries required to fetch inherited models.
- Control: Ability to disable polymorphic behavior when necessary.