Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_extra_restriction() missing required positional argument related_alias #776

Closed
bsiebens opened this issue Dec 7, 2021 · 2 comments
Closed
Labels

Comments

@bsiebens
Copy link

bsiebens commented Dec 7, 2021

Using Django-Taggit on Django 4.0rc1 (running on Python 3.9). I have a model called TransactionJournal that contains following line:

tags = TaggableManager(blank=True)

Querying the model with the following statement results in the below error:

TransactionJournal.objects.filter(tags__name__in=["t1", "t2"])

Traceback (most recent call last): File "<console>", line 1, in <module> File "/Users/XXX/.local/share/virtualenvs/YYY-rEzd9bfd/lib/python3.9/site-packages/django/db/models/query.py", line 256, in __repr__ data = list(self[:REPR_OUTPUT_SIZE + 1]) File "/Users/XXX/.local/share/virtualenvs/YYY-rEzd9bfd/lib/python3.9/site-packages/django/db/models/query.py", line 280, in __iter__ self._fetch_all() File "/Users/XXX/.local/share/virtualenvs/YYY-rEzd9bfd/lib/python3.9/site-packages/django/db/models/query.py", line 1354, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/Users/XXX/.local/share/virtualenvs/YYY-rEzd9bfd/lib/python3.9/site-packages/django/db/models/query.py", line 51, in __iter__ results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "/Users/XXX/.local/share/virtualenvs/YYY-rEzd9bfd/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1189, in execute_sql sql, params = self.as_sql() File "/Users/XXX/.local/share/virtualenvs/YYY-rEzd9bfd/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 545, in as_sql from_, f_params = self.get_from_clause() File "/Users/XXX/.local/share/virtualenvs/YYY-rEzd9bfd/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 833, in get_from_clause clause_sql, clause_params = self.compile(from_clause) File "/Users/XXX/.local/share/virtualenvs/YYY-rEzd9bfd/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 463, in compile sql, params = node.as_sql(self, self.connection) File "/Users/XXX/.local/share/virtualenvs/YYY-rEzd9bfd/lib/python3.9/site-packages/django/db/models/sql/datastructures.py", line 81, in as_sql extra_cond = self.join_field.get_extra_restriction(self.table_alias, self.parent_alias) File "/Users/XXX/.local/share/virtualenvs/YYY-rEzd9bfd/lib/python3.9/site-packages/django/db/models/fields/reverse_related.py", line 168, in get_extra_restriction return self.field.get_extra_restriction(related_alias, alias) TypeError: get_extra_restriction() missing 1 required positional argument: 'related_alias'

Any thoughts on what might be causing this?

@bsiebens bsiebens changed the title get_extra_restriction() missing required positional argument related_alias get_extra_restriction() missing required positional argument related_alias Dec 7, 2021
@rtpg rtpg added the bug label Dec 9, 2021
@rtpg
Copy link
Contributor

rtpg commented Dec 9, 2021

We don't have support for Django 4.0 just yet (it's not even being tested in CI), but according to the release notes of Django 4.0 the signature for get_extra_restriction changed (the where_class parameter is no longer used).

So yeah, this is something that will likely get fixed with Django 4.0 support

@Hakonta
Copy link

Hakonta commented Dec 13, 2021

I'm experiencing the same issue.

Please let us know if anyone finds any workarounds for this issue in the meantime.

philgyford added a commit to philgyford/django-ditto that referenced this issue Dec 15, 2021
It *should* probably all work once django-taggit releases a version
that supports Django 4.0 and python 3.10.

See jazzband/django-taggit#776

For #223
monty5811 added a commit to monty5811/django-taggit that referenced this issue Dec 15, 2021
 - add a shim around `get_extra_restriction` so that it works in
   versions of Django >=4 and <4
 - fixes jazzband#776
@auvipy auvipy closed this as completed in d083396 Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants