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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion django_elasticsearch_dsl/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
LongField,
ShortField,
TextField,
)
ObjectField)
from .search import Search

model_field_class_to_field_class = {
Expand All @@ -49,8 +49,16 @@
models.URLField: TextField,
}

try:
from django.contrib.postgres.fields import JSONField
model_field_class_to_field_class[JSONField] = ObjectField
except ImportError:
pass


class DocType(DSLDocument):
_prepared_fields = []

def __init__(self, related_instance_to_ignore=None, **kwargs):
super(DocType, self).__init__(**kwargs)
self._related_instance_to_ignore = related_instance_to_ignore
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
django>=1.9.6
elasticsearch-dsl>=7.0.0,<8.0.0