Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can django-moderation and django-reversion work together for a content_type?

We are working on a django website in which we want to give users control of the content, but we want to have administrator users to moderate the content, and a queue of the accepted content in case some superuser want to rollback data to a specific version in the past.

I cannot find a django app to make both things. I was reading about django-moderation and django-reversion, and I was wondering if there is a way to make them work together.

I saw that this is a recurrent question, but no one answers it right. The typical answer is use one or another, but no one seems to have a solution for the problem.

I read that the main problem is that in case of having moderation and versions for a content, it may (for sure) create a tree of versions.

But then, I thought that I want only the accepted versions to be stored, then the past versions would generate a lineal history backwards in time, i.e. if I revert something and accept a new thing, then I think it's ok to delete the rejected branch from the point where I reverted when I accept (then store) the new version, leading to a new branch.

Is that possible to do with both django-moderation and django-reversion?

Info about the apps:

[1] https://github.com/etianen/django-reversion/wiki

[2] https://github.com/dominno/django-moderation

like image 717
jperelli Avatar asked Jan 25 '12 22:01

jperelli


1 Answers

'Yes'.

So I had this same problem, but I also had the problem that django-moderation seems more than a little unmaintained.

I forked django-moderation at https://github.com/CBWhiz/django-moderation and made a bunch of changes to actually get it working under Django 1.4. I'm pretty certain I broke a bit of backwards compatibility though, so i'm not sure if my branch will ever be re-merged.

As for django-reversion, it works well together for my needs. I had to add a hack to django-moderation specificly to support it though: https://github.com/CBWhiz/django-moderation/commit/3b367d68954cea3d7910d8efc5850a136229db0e#L0R49

So, installing django-reversion and my branch of django-moderation works reasonably well together.

The only possible snag might be that the reversion history will add an entry every time you hit save, not when you approve, so it also stores unapproved edits. That could conceivably be hacked around also if you felt up for it.

like image 196
EB. Avatar answered Sep 30 '22 01:09

EB.