Opened 5 years ago

Closed 5 years ago

#30853 closed Bug (duplicate)

field__foo__contains dont work in 2.2.6 on JSONField

Reported by: Alexey Owned by: nobody
Component: Database layer (models, ORM) Version: 2.2
Severity: Normal Keywords: jsonfield
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

please check

After I Updated Django version from 2.2.5 to 2.2.6
my code start rise exception

Entety.objects.filter(field__foo__contains='')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "site-packages/django/db/models/query.py", line 250, in __repr__
    data = list(self[:REPR_OUTPUT_SIZE + 1])
  File "site-packages/django/db/models/query.py", line 274, in __iter__
    self._fetch_all()
  File "site-packages/django/db/models/query.py", line 1242, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "site-packages/django/db/models/query.py", line 55, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "python3.5/site-packages/django/db/models/sql/compiler.py", line 1087, in execute_sql
    sql, params = self.as_sql()
  File "python3.5/site-packages/django/db/models/sql/compiler.py", line 489, in as_sql
    where, w_params = self.compile(self.where) if self.where is not None else ("", [])
  File "python3.5/site-packages/django/db/models/sql/compiler.py", line 405, in compile
    sql, params = node.as_sql(self, self.connection)
  File "python3.5/site-packages/django/db/models/sql/where.py", line 81, in as_sql
    sql, params = compiler.compile(child)
  File "python3.5/site-packages/django/db/models/sql/compiler.py", line 405, in compile
    sql, params = node.as_sql(self, self.connection)
  File "python3.5/site-packages/django/contrib/postgres/lookups.py", line 11, in as_sql
    params = lhs_params + rhs_params
TypeError: can only concatenate tuple (not "list") to tuple

Change History (1)

comment:1 by Mariusz Felisiak, 5 years ago

Resolution: duplicate
Status: newclosed

Thanks for this report, we're going to fix this in Django 2.2.7.

Duplicate of #30826.

Note: See TracTickets for help on using tickets.
Back to Top