0

I have a model that is under version control using Django-Reversion. Within a Terminal window I can access all of the previous versions of a model instance using:

foo = FooModel.objects.get()
versions = Version.objects.get_for_object(foo)

When I check versions it's a set of all the previous versions. However when I call this same function in a view and try to add it to context all I get a in a single VersionQuerySet that I can't figure out how to iterate through and pull data out of.

Any suggestions?

Rileywiley
  • 139
  • 11

1 Answers1

0

Try calling list on the versions object. This should force the QuerySet to evaluate its items:

versions = Version.objects.get_for_object(foo)
new_versions = list(versions)
Moses Koledoye
  • 77,341
  • 8
  • 133
  • 139