AttributeError: 'NoneType' object has no attribute 'get_name' #661
Unanswered
markjrouse
asked this question in
Q&A
Replies: 1 comment
-
Unfortunately, unpacking of JSON field is not supported by default in ormar. That can probably be built into https://github.com/tophat/ormar-postgres-extensions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I trying to run a query against my Postgres db using Ormar, with the following query against nested data in a json field:
queryset = await Registry.objects.filter( **{"service_connections__connections__contains": [{"id": id}]} ).values_list( "service_connections__connections", flatten=True )
So I'm looking to search in my service_connections field which is a JSON field and has a structure like this:
{ 'connections': [ {'id': '27871f2d-101c-449e-87ad-36a663b144fe', 'vlan_id': 101}, {'id': '94b1d7a2-7ff2-4ba3-8259-5eb7ddd09fe1', 'vlan_id': 203} ] }
and I get the following error from Ormar.
E AttributeError: 'NoneType' object has no attribute 'get_name' /usr/local/lib/python3.9/site-packages/ormar/models/excludable.py:277: AttributeError
Basically I want the query to return all service_connections__connection where my id is found.
Beta Was this translation helpful? Give feedback.
All reactions