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

Implement distinct() #31

Open
mauroka opened this issue Jul 4, 2017 · 8 comments
Open

Implement distinct() #31

mauroka opened this issue Jul 4, 2017 · 8 comments

Comments

@mauroka
Copy link

mauroka commented Jul 4, 2017

Hello, I'm trying to integrate django-querysetsequence with django-datatable-view (https://github.com/pivotal-energy-solutions/django-datatable-view)

When this component executes a search a NotImplementedError: QuerySetSequence does not implement distinct() error arrises.

So I would like to know if you plan to implement distinct in the future.

By the way, I fix it so when I use querysetsequence it doesn't use distinct, but of course, there are some duplicated results.

Thanks a lot for the help.
Mauro.

@clokep
Copy link
Owner

clokep commented Jul 5, 2017

@mauroka I don't have any plans to implement distinct() at the moment, it's not needed for my application. I could definitely set aside time to offer guidance and review a pull request implementing this though!

The real downside is that there probably isn't a sane implementation besides just caching all the results, which makes it incompatible with e.g. iterator().

@mauroka
Copy link
Author

mauroka commented Jul 5, 2017

Hello @clokep, thanks for the response.
Let me see if I can manage myself with an implementation without using distinct(). In case I require it, I will implement distinct() with your help.
Thanks a lot.
Mauro.

@clokep
Copy link
Owner

clokep commented Jul 5, 2017

Sounds great! Let me know if you have more questions.

@sanjeevjohal
Copy link

@mauroka how did you fix the querysetsequence so that it doesn't use distinct?

@clokep
Copy link
Owner

clokep commented Aug 22, 2018

@sanjeevjohal It probably depends on your specific application. I suspect this would be easier to implement now that the internals of QuerySetSequence are much simpler.

@sanjeevjohal
Copy link

@clokep I'm using it within an admin class where I've overridden the get_queryset method and when i use the ModelAdmin.list_filter I get this error or any other not implemented attribute (e.g when I try to use the date_heirarchy i get the aggregate attribute not supported).

Any help will be greatly appreciated. Many thanks.

PS. I'm a relatively new to Django and learning every day 😄

@mauroka
Copy link
Author

mauroka commented Aug 22, 2018

@sanjeevjohal I modified django-datatable-view, not django-querysetsequence.
Right now I'm migrating to this component https://bitbucket.org/pigletto/django-datatables-view-example/

@sanjeevjohal
Copy link

Thanks @mauroka.

@clokep I should add I'm still on v1.8 and have no plans to upgrade to v1.11 where you can now combine querysets using a union. I did try to use the set operator | but this didn't give me a union which I understand removes duplicates even after I deliberately made an attribute in both models different

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants