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

`invalidate_m2o` and polymorphic models

Open aletor123 opened this issue 3 years ago • 0 comments

Now there is problem with polymorphic models and invalidate_m2o. When Model is inherited it's pk field is OneToOne field to parent model. And if there is some other model with FK to inherited model, this FK points to OneToOne field. In this situation getattr(instance, f.field_name) will return model instance of parent model, when we need to get id.

Pull request: https://github.com/Suor/django-cacheops/pull/430

aletor123 avatar Jun 02 '22 12:06 aletor123