Issue #1 resolved

Subclassing a moderated model raises exceptions

Rajeesh Nair
repo owner created an issue

If there is a moderated model, Book and we sub-classed it into EBook, by default, any ebook instance should have a corresponding book instance also created. It should always be accessible by the book_ptr attribute. But our moderated models do not do that. See the example below: {{{

eb1 = EBook.objects.create(name="Test book", pages=300) EBook.objects.count() 1

No corresponding book created

Book.objects.count() 0 eb1.book_ptr_id 1 eb1.book_ptr DoesNotExist: Book matching query does not exist. }}} We have inherited this issue from django-gatekeeper it seems. So the problem must be with the custom manager/queryset.

Comments (5)

  1. Rajeesh Nair reporter

    Django creates the parent instances as usual. So for each EBook instance, a corresponding Book instance also is created. But our custom manager has become unable to load those parent instances. The custom manager's custom queryset combines each model instance with its own moderation_entry instance to form one row. Our application creates moderation entries on receiving ``post_save`` signals and for sub-classed models, no such signal is emitted by parent models. So the parent instances ended up without having monitor_entries. Can be solved by explicitly creating monitor_entries for all parent models.

  2. Log in to comment