Reverse generic relation to a model inheriting from the model defining a generic relation confuses flush
Please look into attached file, I've created a minimal test project for this bug. You'll have to include your database credentials in
settings.py before you try it.
Let's say we have model with a generic relation (e.g.
django.contrib.comments.models.Comment) and a model deriving from it (e.g.
OtherComment). Now, if a reverse generic relation to
OtherComment is defined, it would correctly work and point to a list of
OtherComment instances. However,
flush would now try to reset the sequence on
id field of
OtherComment which does not exist (
OtherComment only has
comment_ptr_id) while resetting
Comment would be correct.
Change History (4)
|Patch needs improvement:
Core (Management commands)