dominno / django-moderation

django-moderation is reusable application for Django framework, that allows to moderate any model objects.
BSD 3-Clause "New" or "Revised" License
268 stars 91 forks source link

Auto-approval / automoderation issues in the admin? #46

Open swiharta opened 12 years ago

swiharta commented 12 years ago

In the admin, as a superuser editing an instance of a model registered with django_moderation, I have to save the instance 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.

dominno commented 12 years ago

This could be solved by some changes merge, when doing one change after another.

swiharta commented 12 years ago

Sorry, I don't understand, but if you figured out what my issue was, then great!

dominno commented 12 years ago

I ment that this need to be implemented, this is probably related to moderation history per object.

DmytroLitvinov commented 4 years ago

Hi @dominno ,

Could we close this issue?