-
Notifications
You must be signed in to change notification settings - Fork 486
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 for each models.DateField #613
Comments
That's really odd. That implies the version data is no longer compatible
with your model. Do you add fields to your model dynamically anywhere?
It might be worth doing a bit of debugging to find out what the
original DeserializationError was. If you're on Python3, then the "cause"
of the exception should be automatically printed to your console.
Othersise, commenting out lines 204-207 will cause the original exception
to be raised, which will give more information.
…On Sun, 8 Jan 2017 at 01:37 Admdebian ***@***.***> wrote:
I have a model: MyModel
I make revisions from scratch and a new sqlite database.
After the first migration I run my test.
My test creates a MyModel instance and saves it two times.
This happens only if I have a DateField in my model. DateTimeField is not
affected.
I use JSON serializer.
File "/env/lib/python2.7/site-packages/reversion/models.py", line 206, in
_object_version "object_repr": self.object_repr, RevertError: Could not
load MyContentString version - incompatible version data.
Can I help?
My virtualenv has:
Django==1.10
django-autofixture==0.12.1
django-modeladmin-reorder==0.2
Pillow>=2.8.1
django-reversion==2.0.8
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#613>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAJFCJbq1ffinAn6WojxAbJd6hgtxkRiks5rQD3pgaJpZM4LdlBK>
.
|
At the moment, I put a DateField in the model to test. This is my commented code: This is my new error: I have no date format in my settings.py I suggest we insert a new exception for this case. I think it's very common |
This is weird. It implies that the django serialization framework can't
deserialize it's own data.
Try using the django serialization framework to serialize and deserialize
an instance of your model. That'll help pinpoint whether the problem is
there.
…On Mon, 9 Jan 2017 at 15:48 Admdebian ***@***.***> wrote:
At the moment, I put a DateField in the model to test.
This is my commented code:
@cached_property def _object_version(self): data = self.serialized_data
data = force_text(data.encode("utf8")) return
list(serializers.deserialize(self.format, data, ignorenonexistent=True))[0]
try: return list(serializers.deserialize(self.format, data,
ignorenonexistent=True))[0] """ except DeserializationError: raise
RevertError(ugettext("Could not load %(object_repr)s version - incompatible
version data.") % { "object_repr": self.object_repr, }) """ except
serializers.SerializerDoesNotExist: raise RevertError(ugettext("Could not
load %(object_repr)s version - unknown serializer %(format)s.") % {
"object_repr": self.object_repr, "format": self.format, })
This is my new error:
DeserializationError at /admin/MyModule/persone/1/change/
[u"'2017-01-09T02:50:00+01:00' value has an invalid date format. It must
be in YYYY-MM-DD format."]: (lzgest.persone:pk=1) field_value was
'2017-01-09T02:50:00+01:00'
I have no date format in my settings.py
I suggest we insert a new exception for this case. I think it's very common
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#613 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJFCPjHP4_MHn50CYcpXel44OaFECSfks5rQlbFgaJpZM4LdlBK>
.
|
I can't replace the bug anymore. I don't remember but I guess I've been able to save a datetime in my date attribute because I have skipped the clean() method. |
I have a model: MyModel
I make revisions from scratch and a new sqlite database.
After the first migration I run my test.
My test creates a MyModel instance and saves it two times.
This happens only if I have a DateField in my model. DateTimeField is not affected.
I use JSON serializer.
File "/env/lib/python2.7/site-packages/reversion/models.py", line 206, in _object_version "object_repr": self.object_repr, RevertError: Could not load MyContentString version - incompatible version data.
Can I help?
My virtualenv has:
Django==1.10
django-autofixture==0.12.1
django-modeladmin-reorder==0.2
Pillow>=2.8.1
django-reversion==2.0.8
The text was updated successfully, but these errors were encountered: