Django 3.2: _filter_or_exclude: not enough values to unpack (expected 2, got 0)
jedie opened this issue ยท 9 comments
...
File "/home/jens/repos/PyInventory/.venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/jens/repos/PyInventory/.venv/lib/python3.8/site-packages/django/db/models/query.py", line 985, in complex_filter
return self._filter_or_exclude(False, args=(), kwargs=filter_obj)
File "/home/jens/repos/PyInventory/.venv/lib/python3.8/site-packages/tagulous/models/tagged.py", line 119, in _filter_or_exclude
args, kwargs = args
Exception Type: ValueError at /admin/inventory/itemmodel/
Exception Value: not enough values to unpack (expected 2, got 0)
- Django Version: v3.2.8
- Python Version: v3.8.10
- django-tagulous v1.3.0
It's a change in Django 3.1 -> 3.2...
I am seeing this as well, just upgraded my application to Django 3.2.8 and seeing this on startup (runserver
).
Full traceback
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/valentijn/venv/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/valentijn/venv/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "/home/valentijn/venv/lib/python3.8/site-packages/django/core/management/base.py", line 419, in check
all_issues = checks.run_checks(
File "/home/valentijn/venv/lib/python3.8/site-packages/django/core/checks/registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/home/valentijn/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/valentijn/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/valentijn/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 412, in check
for pattern in self.url_patterns:
File "/home/valentijn/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/valentijn/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 598, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/valentijn/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/valentijn/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 591, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/valentijn/dd/dojo/urls.py", line 11, in <module>
from dojo import views
File "/home/valentijn/dd/dojo/views.py", line 12, in <module>
from dojo.filters import LogEntryFilter
File "/home/valentijn/dd/dojo/filters.py", line 745, in <module>
class ApiEngagementFilter(DojoFilter):
File "/home/valentijn/venv/lib/python3.8/site-packages/django_filters/filterset.py", line 71, in __new__
new_class.base_filters = new_class.get_filters()
File "/home/valentijn/venv/lib/python3.8/site-packages/django_filters/filterset.py", line 351, in get_filters
filters[filter_name] = cls.filter_for_field(field, field_name, lookup_expr)
File "/home/valentijn/venv/lib/python3.8/site-packages/django_filters/filterset.py", line 379, in filter_for_field
filter_class, params = cls.filter_for_lookup(field, lookup_type)
File "/home/valentijn/venv/lib/python3.8/site-packages/django_filters/filterset.py", line 399, in filter_for_lookup
params = data.get('extra', lambda field: {})(field)
File "/home/valentijn/venv/lib/python3.8/site-packages/django_filters/filterset.py", line 152, in <lambda>
'queryset': remote_queryset(f),
File "/home/valentijn/venv/lib/python3.8/site-packages/django_filters/filterset.py", line 51, in remote_queryset
return model._default_manager.complex_filter(limit_choices_to)
File "/home/valentijn/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/valentijn/venv/lib/python3.8/site-packages/django/db/models/query.py", line 985, in complex_filter
return self._filter_or_exclude(False, args=(), kwargs=filter_obj)
File "/home/valentijn/venv/lib/python3.8/site-packages/tagulous/models/tagged.py", line 119, in _filter_or_exclude
args, kwargs = args
ValueError: not enough values to unpack (expected 2, got 0)
@jedie @valentijnscholten hope the PR #149 works for you guys as well?
Seems to work, thanks.
In the mean time you can install tagulous from git+https://github.com/nschlemm/django-tagulous.git@250b88c68507b39da7b5a88798e49805b94e81b8#egg=django-tagulous to get the fix.
@valentijnscholten while that is a workaround, I do much rather prefer we have an release to rely on - especially with the next updates regarding https://www.djangoproject.com/weblog/2021/dec/07/django-40-released/ already lining up ;)
Hi, have seen this and will merge and release asap, but I'm really pushed for time atm - please bear with me and I'll try to get it out in the next week or so.
Thanks for bearing with me! Released as 1.3.1.