On Friday 24 March 2017 04:31:32 guettli wrote: > I know this is a crazy idea, and it will get the "won't fix" tag very > soon. > > Nevertheless I want to speak it out. > > My use case: Get a queryset of users who have a given permission.
I'm still thinking about this use case. Cause it's not for normal use - you don't normally use permissions as data, you use permissions to deny / allow access to data. So, you're already in the "specialized" corner. > At the moment this query is complex and results in performance issues, For a small install this works fine. When performance becomes an issue because there's a large number of users and groups, my first instinct is to regroup users so that no permission exceptions exist anymore at the user level. I'd add all superusers to the "wheel" group ("root", "superuser", whatever floats your boat). Now the query to get this info no longer requires the user model for conditions and you can simply query the group manager. It is what groups are for and it'll be always faster get all the matching groups as one set and combine it with all the users that have the permission assigned directly. The "one query" requirement conflicts with your performance requirement. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1777798.MnPFgKG1jH%40devstation. For more options, visit https://groups.google.com/d/optout.