dominno/django-moderation — Issue #45: Add "pending_column" for performance when checking if pending moderation
Author: swiharta
Created: 2011-10-23 15:23:49+00:00
State: open

I'm working out how to add a "pending_column" to improve performance when you want to check which of a large number of moderated model instances are pending moderation. I added a 'pending' Boolean field to my model and referenced it as my 'pending_column' when I subclassed moderator.GenericModerator.

As a first step, in register.py pre_save_handler I added:

'''python
if moderator.pending_column:
setattr(instance, moderator.pending_column, True)
'''

Now viewing the actual model instance in the admin, I can see the 'pending' attribute appropriately set as True, but when I do mymodel_instance.pending, it strangely returns False. I'm not sure what's going on here, likely something to do with the manager, any idea?