dominno/django-moderation — Issue #46: Auto-approval / automoderation issues in the admin?
Author: swiharta
Created: 2011-10-23 17:17:17+00:00
State: open

In the admin, as a superuser editing an instance of a model registered with django_moderation, I have to save the same change twice in order for it to take effect. I'm not using ModerationAdmin.

After the first save, the ModeratedObject edit view in the admin displays the change difference correctly, moderation_reason says "Auto-approved: Superuser", and the status is Approved, but as I said the actual model instance remains unchanged until I save it again. As I discovered later, no matter what changes I make the second time I save, only the changes from the first save are applied to the model instance after saving the second time.

I took a little time to test this a bit more, thought someone might want to know:

If I apply change A (Boolean) and change B (ForeignKey) the first time I save an existing model instance in the admin, then only change A the second time I save, both changes A and B are applied to the model instance as if I had just done the first save. In fact, as I mentioned above, it doesn't matter what changes I make before doing the second save.

As far as the ModeratedObject edit view in the admin, any change that was applied only once displays the change difference with the changes highlighted as I said. Any change applied twice consecutively just displays the new value without the highlighting.

Seems like there is some issue with auto-approval / automoderation in the admin or the way the changed objects are getting passed around? Haven't tested from shell or in views.

As an alternative to saving the object twice, if I go and approve the change in the ModeratedObject admin (despite the existing "approved" status), then the actual model instance gets updated with the saved changes. So to me it seems like maybe some part of the auto-approval process is not working correctly.