Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"incompatible version data" -> migrate versions JSON, too ? #859

Closed
jedie opened this issue Feb 24, 2021 · 3 comments
Closed

"incompatible version data" -> migrate versions JSON, too ? #859

jedie opened this issue Feb 24, 2021 · 3 comments

Comments

@jedie
Copy link
Contributor

jedie commented Feb 24, 2021

Now and then a user may see the error:

reversion.errors.RevertError: Could not load <Foo: bar> - incompatible version data.

e.g.:

First thing to do is IMHO:

  1. Add a clear note about the problem in the documentation. -> docs: Add "incompatible version data" in "common problems" #860
  2. Enhance the error message, so the user knows what happend

On the long run:

Why not hacked into Django migration system and "migrate" the saved JSON data, too?
It is probably not easy. But it should be possible in theory, isn't it?

@etianen
Copy link
Owner

etianen commented Feb 24, 2021 via email

jedie added a commit to jedie/django-reversion-compare that referenced this issue Feb 24, 2021
jedie added a commit to jedie/django-reversion-compare that referenced this issue Feb 24, 2021
jedie added a commit to jedie/django-reversion-compare that referenced this issue Feb 24, 2021
work-a-round for: etianen/django-reversion#859

The test project creates a example. This compare must use the fallback:

![grafik](https://user-images.githubusercontent.com/71315/109011223-f57f1480-76b0-11eb-9055-2aad30cd566e.png)

The fallback compare diff looks in this case like this:

![grafik](https://user-images.githubusercontent.com/71315/109011333-0f205c00-76b1-11eb-8a6c-6c439710d5b5.png)
@jedie
Copy link
Contributor Author

jedie commented Feb 24, 2021

Yes, you may be right, it won't be easy in any case.

A work-a-round that works without migration might be something like that:

  • Load the current model.
  • Change the values field by field from the history. Maybe call clean() after each change. Skip fields that can be assigned or raise a ValidationError

But this is not a really nice solution. But at least better than just to crash ;)

@etianen
Copy link
Owner

etianen commented Feb 25, 2021 via email

@etianen etianen closed this as completed Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants