Skip to content

Adding support for Postgresql JSONField #220

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

Merged
merged 3 commits into from
Nov 24, 2019

Conversation

safwanrahman
Copy link
Collaborator

No description provided.

@safwanrahman safwanrahman changed the title Adding support for Postgresql Jsonfield Adding support for Postgresql JSONField Oct 31, 2019
@safwanrahman safwanrahman merged commit dc3d89f into django-es:master Nov 24, 2019
@safwanrahman
Copy link
Collaborator Author

As could not find any reviewer, I am good to have this r+

@andreasnuesslein
Copy link
Contributor

@safwanrahman does it work for you out of the box now?
I still am getting a list of empty dicts (with the psql-db-value being {"2": "sadf", "foo": "baaar"}):

"negotiation_status": [
  {}
  {}
],

Only when I do:

    def prepare_negotiation_status(self, instance):
        return instance.negotiation_status

I get:

"negotiation_status": {
  "2": "sadf",
  "foo": "baaar"
},

@safwanrahman
Copy link
Collaborator Author

@andreasnuesslein Oops, Sorry. I expected to have it working normally. I need to fix it before releasing new version. Are you using master branch? It is high likely that there is error code.

@andreasnuesslein
Copy link
Contributor

@safwanrahman Yeah I tried it with master but the same thing happens with the current stable pip release 7.1.0 , after setting negotiation_status = fields.ObjectField().

@andreasnuesslein
Copy link
Contributor

mentioning #36 here for bidirectional link

safwanrahman added a commit that referenced this pull request Dec 26, 2019
safwanrahman added a commit that referenced this pull request Dec 26, 2019
@andreasnuesslein
Copy link
Contributor

So I dove into the code and figured out you should just replace ObjectField with DEDField.

@oehrlein
Copy link
Contributor

@andreasnuesslein I'm having a similar issue. Where did you replace ObjectField with DEDField?

@andreasnuesslein
Copy link
Contributor

hey @oehrlein , I think it was somewhere here: https://github.com/django-es/django-elasticsearch-dsl/blob/master/django_elasticsearch_dsl/documents.py#L27

but since then the code has been changed a bit it seems - sorry 🤷 I'm not involved in this anymore; @safwanrahman will probably know an answer.

@oehrlein
Copy link
Contributor

oehrlein commented Nov 1, 2020

@andreasnuesslein Got it, no problem! I was just curious since I was working on (and found) a solution to the "list of empty dicts" issue you had above.

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

Successfully merging this pull request may close these issues.

3 participants