views:

40

answers:

2

I am building a site where users can make changes to their publicaly displayed profile. However I need all changes to be approved by an admin before going live. Until the changes are approved their old profile will be displayed. In the admin there should be a list of profiles awaiting approval. It is preferable, but not required, to keep a history of versions.

I have looked at django-reversion, but don't think that will handle showing an old version while keeping a new one under-approval.

I'm looking for ways to achieve this with django...

A: 

Two from-the-hip ideas. How about...

Use reversion and add logic which auto-marks a profile as 'unapproved' on save() if the save is not performed by an administrator, then add a custom accessor to your code that gets the latest approved profile from the reversion archive.

Or, if reversion won't play nicely, have a 'current profile' and 'pending profile' for each user and update the FKs when the profile is approved...

stevejalim
Thanks Steve. I went for the out-the-box solution with moderation as they described a use case that described exactly what I was doing "User change his profile, old profile data is visible on site. New data will be visible on site when moderator approves it."I did see another solution - Django-Gatekeeper that looks very similar: http://github.com/sunlightlabs/django-gatekeeper Turns out reversion could be very useful to me also, to keep a history of changes to user's profiles. Anyone have experience with running django-reversion and django-moderation together?
Meirion Williams
+1  A: 

This apps do exactly what you need http://github.com/dominno/django-moderation

Aldarund
It seems to be doing the trick, many thanks. I had a few problems setting it up - was getting an error saying the model I was setting up was 'already registered for moderation' - however some digging around proved this was something to do with a recursive include. Was fixed by moving the moderation.register calls out into their own moderation.py file, and then including that file.
Meirion Williams