djangonauts / django-pgjson

PostgreSQL json field support for Django
http://djangonauts.github.io/django-pgjson/
Other
131 stars 39 forks source link

Ranges #7

Closed zzart closed 10 years ago

zzart commented 10 years ago

Is there a way to query ranges in jsonb? ie

Something.object.bulk_create([
...     Something(data={"price": 100}),
...     Something(data={"price": 200})
... ])
Something.objects.filter(data__at_price__lt=200)
zzart commented 10 years ago

Got it , thanks for pgjson anyway!

Something.objects.extra(where=["data->'price' > '100'","data->'price' < '200'"])