[Django]-Django-reversion how to get user-id

6👍

revision is a foreign key on Version. And, reversion.get_for_object(Model) simply returns a queryset of Versions. So, for any item in that query set, you can simply access the user as so:

version.revision.user

UPDATE: Just to be more explicit:

versions = reversion.get_for_object(MyModel)

for version in versions:
    print '%s made this revision' % version.revision.user.username

Leave a comment