django-polymorphic
django-polymorphic copied to clipboard
Improved Django model inheritance with automatic downcasting
Renaming a superclass causes "manage.py migrate" to produce invalid SQL. It attempts to copy zero columns from the old model to the updated model. Tested using cpython 3.6.7 and django_polymorphic...
Hello, With Django 3.1.7 and Polymorphic 3.0.0, I'm seeing the error bellow when using something like `obj, created = Book.objects.update_or_create(title='Foo')`. How to use update_or_create with django-polymorphic ? `ValueError: Field 'id'...
There is a chance that `polymorphic_ctype_id` of an object can point a wrong non-proxy ContentType model. If that case happens polymorphic model's get_real_instance_class throws a TypeError instead of RuntimeError. issubclass...
I'm trying to use a through relationship between a polymorphic and a non-polymorphic table with the the RankedAthlete model: ``` class ChoiceBlank(PolymorphicModel): pass class ChoiceAthlete(ChoiceBlank): choice = models.ForeignKey('SomeModel', on_delete=models.CASCADE) class...
I am facing the issue that I have two databases with different data in `django_content_type` tables. I am trying to copy entities from one db into the other and running...
If you have a regular model that has a ForeignKey to a polymorphic model, and then use select_related() from the regular model''s manager/queryset to select the related polymorphic instances we...
I just ran into a cascading bug with polymorphic models when using a non-default/remote database. My goal was to collect and print all entities of the polymorphic models in the...
Hi all, I do have a calculated field current_location on my base model, created a method current_location() on the PolymorphicChildModelAdmin and added it to based_fieldset of PolymorphicChildModelAdmin. However, it throws...
An error occurs when deleting a primary object. Where polymorphic is a foreign key **Spec** > Request Method: POST > Django Version: 3.1.7 > Exception Type: AttributeError > Exception Value:...
Hello and thank you for your great package. I've faced a little problem with migrating when I set new parent class for my polymorphic subclass. Here is an example: before:...