Description
While debugging with django-polymorphic i deleted some data without django-polymorhpic. The real instances table rows are gone, but in the base polymorphic table, the rows with polymorphic_ctype_id
still exist.
BaseClass.objects.all() => empty Queryset
BaseClass.objects.non_polymorphic().all() => Complete Queryset with all "old" data.
if polymorphic_ctype_id
does not match any real row i would expect an exception.
Questions:
1.
how to delete the non_polymorphic-only BaseClass objects?
With non_polymorphic() i get existing BaseClasses plus "corrupt" BaseClasses. How to determine if a non_polymorphic object has no concrete object?
2.
how to avoid this corrupt state in the future? This should normally not happen, but i would feel better if i know the database never can enter this corrupt state.