django-polymorphic
django-polymorphic copied to clipboard
Improved Django model inheritance with automatic downcasting
Issue: Wrong order of new inline elements. Steps to reproduce: 1. Create a model with polymorphic inline in admin 2. Add item with type B 3. Add item with type...
I have a polymorphic model that I made and it has many child models which I want the users to be choosing dynamically, posting the first product has no issue,...
**Problem** Foreign key lookups don't upcast to their actual type when a parent polymorphic model inherits from an [abstract base class](https://docs.djangoproject.com/en/3.0/topics/db/models/#abstract-base-classes). This is inconsistent with the behavior described [here](https://django-polymorphic.readthedocs.io/en/stable/advanced.html#manytomanyfield-foreignkey-onetoonefield). Example:...
I have the following structure: A (PolymorphicModel) / | | D -- E B -- C When I try to delete all A instances with A.objects.all().delete(), I get the following...
I am using django-reversion to support version control of model objects, and I followed the instructions from [Third-party applications support](https://django-polymorphic.readthedocs.io/en/stable/third-party.html#django-reversion-support) in the doc. Below is the example from the doc:...
Hi! I tried using Django FilteredRelation with a PolymorphicQueryset and I got an error https://docs.djangoproject.com/en/3.1/ref/models/querysets/#filteredrelation-objects Some PolymorphicModel: ``` from django.db import models from polymorphic.models import PolymorphicModel class ModelA(PolymorphicModel): comment =...
Hi! `PolymorphicModelBase.__new__()` ([here](https://github.com/django-polymorphic/django-polymorphic/blob/master/polymorphic/base.py#L60)) does not take additional keyword arguments. It makes it impossible to use `__init_subclass__()` method like this: ```python class MyModel(models.Model): def __init_subclass__(cls, *, name, **kwargs): cls.name = name...
I have a model with extra fields but I would like to show these extra fields inside already existing fieldsets from the form base class. I was able to do...
My setup: ```python class License(PolymorphicModel) class ClassLicense(License) class SchoolLicense(License) ``` When running `manage.py test`, I get an IntegrityError during teardown phase of a test that has created one ClassLicense and...
When using a proxy model. Using `ProxyModel.base_objects.all()` will correctly return a QuerySet of base model instances downcasted as proxy model instances. But using `base_objects` prints out this deprecation warning: >...