-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Unions, intersections and differences with tree fields do not work #55
Comments
Thanks for the report!
It would definitely be nice of django-tree-queries supported those types of queries. |
Hi! Just encountered this myself. There's a comment that says: def get_compiler(self, using=None, connection=None, **kwargs):
...
# **kwargs passes on elide_empty from Django 4.0 onwards
return TreeCompiler(self, connection, using, **kwargs) But Django has never sent So, to be compiler compliant, def get_compiler(self, using=None, connection=None, elide_empty=True):
if using is None and connection is None:
raise ValueError("Need either using or connection")
if using:
connection = connections[using]
return connection.ops.compiler(self.compiler)(
self, connection, using, elide_empty
) which should then pass I'll be glad to create a PR with this change as soon as I find some spare time! |
Would be great if that was the case! I'd appreciate a PR. |
Unions, intersections and differences do not seem to work when tree fields are ussed. Since this is not mentioned in the limitations I am not sure if this is deliberate. Specifically, multiple errors are thrown when performing these queries when they include tree fields. I am using django-tree-queries 0.14 and django 4.2.1.
Minimal example:
This throws an error:
which seems to be related to the
elide_empty
not being passed as a keyword argument by this django code. Changing the signature ofTreeQuery.get_compiler
toget_compiler(self, using=None, connection=None, elide_empty = True, **kwargs)
fixes this issue but raises another one. Instead, I get:It seems like a custom implementation of
get_combinator_sql(self, combinator, all)
would probably be required onTreeQuery
to make this work.The text was updated successfully, but these errors were encountered: