djangonauts / django-pgjson

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

FieldError: Unsupported lookup 'at' for JsonBField or join on the field not permitted. #32

Closed mamigot closed 9 years ago

mamigot commented 9 years ago

(Python 3.4.3, Django 1.8.2, django-pgjson0.2.3)

For a model like this:

class Result(models.Model):
    timestamp = models.DateTimeField(blank=True, null=True)
    attributes = JSONField(null=True, blank=True, default={})

I'm conducting this query (out of the docs):

Result.objects.filter(attributes__at__side="Right")

and getting this error:

FieldError: Unsupported lookup 'at' for JsonBField or join on the field not permitted.

Thank you!!

mamigot commented 9 years ago

It was my fault –I had an additional underscore between "at" and "side" in the query. This works perfectly Result.objects.filter(attributes__at_side="Right")!