django-polymorphic icon indicating copy to clipboard operation
django-polymorphic copied to clipboard

Improved Django model inheritance with automatic downcasting

Results 150 django-polymorphic issues
Sort by recently updated
recently updated
newest added

Say we have the following model structure: ``` class Event(models.PolymorphicModel): image = models.ImageField(width_field='image_width', height_field='image_height') image_width = models.IntegerField() image_height = models.IntegerField() class UserEvent(Event): user = models.ForeignKey('User', on_delete=models.CASCADE) ``` The image_width and...

**Issue with** ``` Django==1.11.13 django-polymorphic==2.0.3 djangorestframework==3.9.3 ``` **Summary** Django fails creating the first migrations when using polymorphic and Django Rest Framework simultaneously. The part of the code that triggers the...

I am using **djangot-polymorphic** and so far it worked fine, but I don't know how to convert an object from one type to another, that is, _modify the inheritance_. I...

Hi is is it possible to change the name of the ctype column? We are developing our database with django, but at some point we would like the postgres database...

My project settings (my_django_project): ... INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'polymorphic', 'my_app', ) ... My application models (my_app): ``` python from __future__ import unicode_literals from django.contrib...

I'm sorry if this has been asked before, or has been documented somewhere, but I can't seem to find a way to do the following... Say we have a `NormalModel`,...

I'm using `django.core.management.call_command('dumpdata')` directly to export data dynamically. This should use the `base_objects`. It won't because it's only used when `django/core/management/commands/dumpdata.py` is in the stack, which is a bit hacky....

bug

Hi guys, There's a ticket that already solved a problem for normal inheritance classes in django (https://code.djangoproject.com/ticket/24997), but in django_polymorphic it doesn't work. Is there anyone facing the same problem?...

enhancement

``` datebased_prices = ( BasePrice.objects.instance_of(DateBasedPrice) .filter(car=car, DateBasedPrice___range__overlap=DateRange(range.lower.date(), range.upper.date())) .annotate(range_overlap=F('DateBasedPrice___range')) ) datetimebased_prices = ( BasePrice.objects.instance_of(DateTimeBasedPrice) .filter(car=car, DateTimeBasedPrice___range__overlap=range) .annotate(range_overlap=F('DateTimeBasedPrice___range')) ) prices = (datebased_prices | datetimebased_prices) ``` all times return **None** in _range_overlap_

With the following model structure: ``` class BaseRegular(models.Model): model_id = AutoField(primary_key=True) ... class BasePolymorphic(PolymorphicModel): ... class MyModel(BasePolymorphic, BaseRegular): ... ``` When trying to delete an instance of MyModel, a DoesNotExist...