Skip to content

chore: drop related name on base model created_by_user#485

Open
winged wants to merge 1 commit intoprojectcaluma:mainfrom
winged:fix_user_acl
Open

chore: drop related name on base model created_by_user#485
winged wants to merge 1 commit intoprojectcaluma:mainfrom
winged:fix_user_acl

Conversation

@winged
Copy link
Copy Markdown
Contributor

@winged winged commented Dec 24, 2024

This caused, for example, on the User model to set an acl attribute, pointing to the creator.

This is very confusing, for example if searching for all users within a scope:

User.objects.filter(acl__scope__in=scope_list)

This would return the user who has created all those ACLs, instead of the users who are in fact granted the ACL.

The correct way would have been

User.objects.filter(acls__scope__in=scope_list)

So to avoid this confusion (and others), we'll remove the related name.

This caused, for example, on the `User` model to set an `acl`
attribute, pointing to the creator.

This is very confusing, for example if searching for all users within a scope:

>>> User.objects.filter(acl__scope__in=scope_list)

This would return the user who has *created* all those ACLs, instead of the
users who are in fact *granted* the ACL.

The correct way would have been

>>> User.objects.filter(acls__scope__in=scope_list)

So to avoid this confusion (and others), we'll remove the related name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant