django-denorm / django-denorm

provides a declarative way of denormalizing models in Django based applications while maintaining data consistency.
http://django-denorm.github.io/django-denorm/
Other
195 stars 56 forks source link

Multi-table inheritance not supported? #23

Open Kronuz opened 11 years ago

Kronuz commented 11 years ago

For cases like where @depend_on_related('myapp.MultiTableModel', foreign_key='some') is used in a multi-table inheritance setting, when the foreign key field some is actually in the parent model of MultiTableModel, the trigger to set the dirty flag are, nonetheless, created as:

INSERT INTO denorm_dirtyinstance (content_type_id,object_id) VALUES(75,some_id);

When they should be instead created as:

INSERT INTO denorm_dirtyinstance (content_type_id,object_id) (SELECT DISTINCT 75, some_id FROM myapp_multitableparentmodel WHERE id = NEW.multitableparentmodel_ptr_id);

I added a gist with a patch to fix this: https://gist.github.com/Kronuz/5091384

kennknowles commented 10 years ago

How about a pull request so it is easier to merge?

Kronuz commented 10 years ago

This should be fixed in a commit in my pull request #43