Query/Filter revisions

80 views
Skip to first unread message

faw...@gmail.com

unread,
Dec 3, 2017, 10:00:55 AM12/3/17
to django-reversion discussion group
Say I have a model Foo with field bar and 50 instances created (with versioning enabled)

How can apply query filter on the versions?

Something along the lines of

Foo.objects.filter(versions__bar__in=('x', 'y', 'z'))

or

FooVersions.objects.filter(bar__in=('x', 'y', 'z'))

Thanks.

Dave Hall

unread,
Dec 5, 2017, 10:31:11 AM12/5/17
to django-r...@googlegroups.com
You can't filter versions by any fields on the version-controlled model. The model is stored as JSON using the django serialization framework, so querying on it is impossible.

...well, not quite true. There has been some talk of standardizing the django-reversion serialization format to JSON (dropping support for other formats), which would allow postgres only filtering of revision data. The amount of effort to port existing revision databases over, however, and a general desire to continue supporting different serialization formats, means it's not progressed.

--
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-reversion+unsubscribe@googlegroups.com.
To post to this group, send email to django-reversion@googlegroups.com.
Visit this group at https://groups.google.com/group/django-reversion.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages