etianen / django-reversion

django-reversion is an extension to the Django web framework that provides version control for model instances.
https://django-reversion.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.04k stars 489 forks source link

Allow displaying "non-recoverable" objects as read-only #945

Closed PavelPancocha closed 1 year ago

PavelPancocha commented 1 year ago

Idea: It could happen, that you have some Version available, but you are not able to recover it.

But it still can have the value for you to just display the data of the object "how did it look" before.

I can prepare PR for this and #944 - @etianen let me know :)

Relates to: #944

etianen commented 1 year ago

Unfortunately, the way the recover preview works is that it performs a revert in a database transaction, displays the data, then rolls back the transaction.

Any other way of previewing a rollback falls apart pretty quickly. All related fields (foreign keys, admin inlines) need special-case handling that requires delving into protected Django internals. django-reversion used to work like this once and it broke all the time whenever Django changed it's internals.