question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'CombinedExpression' object is not iterable when using an admin filter on Django 1.8

See original GitHub issue

Hi,

I’m having a problem when using BitFieldListFilter on Django 1.8

Selecting any item in the filter raises the following error:

Traceback:
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/contrib/admin/options.py" in wrapper
  616.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
  110.                     response = view_func(request, *args, **kwargs)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/contrib/admin/sites.py" in inner
  233.             return view(request, *args, **kwargs)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapper
  34.             return bound_func(*args, **kwargs)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
  110.                     response = view_func(request, *args, **kwargs)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/utils/decorators.py" in bound_func
  30.                 return func.__get__(self, type(self))(*args2, **kwargs2)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/contrib/admin/options.py" in changelist_view
  1548.                 self.list_max_show_all, self.list_editable, self)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/contrib/admin/views/main.py" in __init__
  82.         self.get_results(request)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/contrib/admin/views/main.py" in get_results
  177.         result_count = paginator.count
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/core/paginator.py" in _get_count
  77.                 self._count = len(self.object_list)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/db/models/query.py" in __len__
  144.         self._fetch_all()
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/db/models/query.py" in _fetch_all
  965.             self._result_cache = list(self.iterator())
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/db/models/query.py" in iterator
  238.         results = compiler.execute_sql()
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/db/models/sql/compiler.py" in execute_sql
  829.             sql, params = self.as_sql()
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/db/models/sql/compiler.py" in as_sql
  387.             where, w_params = self.compile(self.query.where)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/db/models/sql/compiler.py" in compile
  357.             sql, params = node.as_sql(self, self.connection)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/db/models/sql/where.py" in as_sql
  104.                     sql, params = compiler.compile(child)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/db/models/sql/compiler.py" in compile
  357.             sql, params = node.as_sql(self, self.connection)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/django/db/models/lookups.py" in as_sql
  210.         lhs_sql, params = self.process_lhs(compiler, connection)
File "/Users/antonin/Documents/Projects/venv/lib/python3.4/site-packages/bitfield/query.py" in process_lhs
  38.             params.extend(self.get_db_prep_lookup(self.rhs, connection)[1])

Exception Type: TypeError at /admin/core/item/
Exception Value: 'CombinedExpression' object is not iterable

It looks like this should be fixed for Django 1.8

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
DylannCordelcommented, Jan 18, 2017

this problem is still there with the last released version of django-bitfield (1.9.1)

1reaction
giorgospcommented, Mar 29, 2016

Is this going to be merged soon?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django/ How get sum of order - 'int' object is not iterable
I'm trying to withdraw the order amount using the method from the model, but I can't.
Read more >
Query Expressions - Django documentation
Query expressions describe a value or a computation that can be used as part of an update, create, filter, order by, annotation, or...
Read more >
django Object not iterable error - Google Groups
How do I troubleshoot something like this. The stacktrace is not really helpful as it does not point to the code that is...
Read more >
Django Tips #13 Using F() Expressions
In the Django QuerySet API, F() expressions are used to refer to model field values directly in the database.Let's say you have a...
Read more >
[Solved]-Django getstream User object is not iterable-django
... quick google search (bear with me, I haven't used GetStream yet) I think you can also instantiate enricher = Enrich() without passing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found