Show history of all model instances in same page

53 views
Skip to first unread message

parn...@gmail.com

unread,
May 10, 2016, 5:12:19 PM5/10/16
to django-reversion discussion group
Hello,

I don't know if it's possible but I'm looking for a simple way to list the versions/revisions of all instances of a Model in a single page.

Let my explain better.
Right now I'm using django-reversion with the basic admin integration (I've followed the Getting Started guide).
From the model page in the admin /admin/<app>/<my_model>/ I can restore the deleted instances, but to see the history of revisions I've to search the correct instance, open it (/admin/<app>/<my_model>/<id>/), click history /admin/<app>/<my_model>/<id>/history, where I can view the edits only for that particular instance.

I'm looking for a way to implement a page like /admin/<app>/<my_model>/history that list all revisions of all instances for my_model.
I basically need to create this sort of report for auditing reasons (list all recent edits and view who made them).

Thanks,
p.

Dave Hall

unread,
May 11, 2016, 5:09:35 AM5/11/16
to django-reversion discussion group
Find all versions for a given model class:

from reversion.models import Version
Version.objects.filter(content_type=ContentType.objects.get_for_model(YourModel))

--
You received this message because you are subscribed to the Google Groups "django-reversion discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-reversi...@googlegroups.com.
To post to this group, send email to django-r...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-reversion.
For more options, visit https://groups.google.com/d/optout.

parn...@gmail.com

unread,
May 17, 2016, 2:40:19 PM5/17/16
to django-reversion discussion group
Thank you Dave for the tip.
With your query I've managed to create a simple page with the edits as I wanted.

Bye,
P
Reply all
Reply to author
Forward
0 new messages