-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Remove django guardian from querysets #5853
Conversation
We set these permissions when we save a project or a version https://github.com/rtfd/readthedocs.org/blob/1ee57dec16f352d14ca17c1bcd8877a9a88a8f0a/readthedocs/projects/models.py#L424-L425 https://github.com/rtfd/readthedocs.org/blob/1ee57dec16f352d14ca17c1bcd8877a9a88a8f0a/readthedocs/builds/models.py#L249-L250 We set them to all the owners of a project, we already know all projects of an user with `user.projects`. For now I'm just removing guardian from the querysets, in another PR I'm going to remove the dep of guardian
I triggered a couple of builds locally, nothing broken so far |
Got a duplicated :/ |
Wasn't able to remove the distinct call, but I have other ideas, but in another PR after this. |
@@ -91,9 +91,9 @@ def _add_user_repos(self, queryset, user=None): | |||
if user.has_perm('builds.view_version'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, we don't set this in any part of the code, so I guess this can only be done in the db, but again, I don't think we do that or want to do that.
I didn't see so much changes in the number of queries, actually the number of queries got reduced in the project dashboard page |
There's also this, but I think it is the same as the project save: |
Yeah, it's the same, it adds another user to the project-user relationship |
This is related to readthedocs#5853
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an obvious and simple change. Hopefully it doesn't break everything :D
Let's not break the internet 🤞 |
This is related to readthedocs#5853
Tested this with |
We set these permissions when we save a project or a version
https://github.com/rtfd/readthedocs.org/blob/1ee57dec16f352d14ca17c1bcd8877a9a88a8f0a/readthedocs/projects/models.py#L424-L425
https://github.com/rtfd/readthedocs.org/blob/1ee57dec16f352d14ca17c1bcd8877a9a88a8f0a/readthedocs/builds/models.py#L249-L250
We set them to all the owners of a project,
we already know all projects of an user with
user.projects
.For now I'm just removing guardian from the querysets,
in another PR I'm going to remove the dep of guardian
This also removes the use of(This failed, I'm keeping distinct :/)distinct
(this generates problems when trying to do another or|
)