-
Notifications
You must be signed in to change notification settings - Fork 270
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
JSONField not deserialized when used from inside a polymorphic inherited model #101
Comments
I am having the same issue, has anyone come across any fixes for this? |
I guess this happens due to the pk check: https://github.com/bradjasper/django-jsonfield/blob/master/jsonfield/fields.py#L75 Because multi-table inherited objects have no pk, the field doesn't deserialize. |
We're hitting this also, just came across this when trying to figure out why JSON strings are being passed to templates in a subclassed model. I think the pull request that brad didn't use here (https://github.com/mkhattab/django-jsonfield/commit/3583718f9ba6db510b555a5cb16338f0ee0095f9) might work. I'm going to fork and give it a try. |
I think I am seeing the same issue. My code works (and has worked) under 0.9.20 but fails under 0.9.22 and later. |
@electroniceagle were you ever able to try the forked version? I am trying to clear some time to work on this project and any additional info will help. |
I made a slightly different wrapping of the AttributeError try block and this is working for us in production, but I haven't tested whatever south data migration error you were attempting to fix with the pk if clause. |
Thanks @vietord for that fix! |
@nicolaslevy All credit to @electroniceagle for the fix! We have been running it in production for a while now, and we haven't run into any unexpected complications with it. (Django 1.4 environment) However! We have not yet found ourselves in the scenario described by #52 None of the south(0.7.6) migrations we've done in areas which use JSONField since applying this fix do anything but simple db column addition or deletion manipulations. |
That fork fix seems to fix the inheritance case, but seems to break #33 again because it will try to parse ordinary strings if you pass them in as initial values. Poking around but can't find much documentation on the whole pk throwing an error because _ptr_id property doesn't exist that seems to be the cause of the original bug... |
Fix polymorphic object issue: rpkilby#101
Here's a class of test cases that should work, but don't if they're added to
Instead, I'm seeing 11 failures, most of which involve the deserialization not happening, for example:
|
This fork is required to support multi-table inheritance. The original has a bug (rpkilby/jsonfield#101). Signed-off-by: Paolo Bonzini <[email protected]>
This fork is required to support multi-table inheritance. The original has a bug (rpkilby/jsonfield#101). Signed-off-by: Paolo Bonzini <[email protected]>
This fork is required to support multi-table inheritance. The original has a bug (rpkilby/jsonfield#101). Signed-off-by: Paolo Bonzini <[email protected]>
This fork is required to support multi-table inheritance. The original has a bug (rpkilby/jsonfield#101). Signed-off-by: Paolo Bonzini <[email protected]>
Hi all. Tests have added for Django's builtin multi-table inheritance, but not for integration with django-polymorphic. If there are still issues, please let me know. Thanks! |
Hi,
I have models like this:
Note: polymorphic is here.
Say I do:
Then I got:
And this is pretty annoying because it will obviously fail in many places because all my code expects a list.
I have read #92, but I didn't find any obvious/easy clue on how to solve this issue.
Any other hint I can try?
For the record, my models are much complex than this. You can view the base feed here and the rss/atom feed here. I've tried with or without default, with or without
load_kwargs={'object_pairs_hook': collections.OrderedDict}
, this doesn't change anything.I've tried the other JSONField implementation and the problem doesn't occur, even after a south migration (I'm on Django 1.6).
regards,
The text was updated successfully, but these errors were encountered: