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
269 stars 90 forks source link

Simplify ModeratedObject._moderate method. #114

Closed qris closed 10 years ago

qris commented 10 years ago

The original method was very unclear about what it was doing, and also saved the base object more often than was necessary. I added a lot of comments to explain what's happening, and restructured the code so that the variables and the reasons for following certain branches are clearer and the code is more readable in my view.

I also avoid calling self.changed_object.save(), and call save_base(raw=True) instead to avoid triggering the pre_save and post_save hooks again, which would re-moderate the object.