Closed raulsperoni closed 2 years ago
Hi @raulsperoni , thank you for the code snippet and example. I see your intent now.
To make it work properly (with the first configuration), you need to assert the member pointer:
self.assertTrue(user_3.member_ptr in org_grand_child.members)
To make it work via the Usuario
model instead you need to write your own OrganisacionGroupMember
subclassing from GroupMemberMixin
, so you can override the member
foreign key to point to your model.
This works with Proxies as well.
oh I see now. Thank you!
Do you think there's any advantage or need for me to subclass GroupMember? I only care about correct permissions, I don't need any further fields in membership.
thanks
Then no, I wouldn't do it!
If you are starting a big project and you know you might require them in the future, setting this up now would save you a couple of migrations in the future, but if you think it will not be relevant then you can just use the .member_ptr
.
Thank you!
Hello, I'm trying to build a test that checks permissions and memberships as I'm still trying to understand how I will use this permissions. I have custom Member and Group (app
core
):And the (simplified) test is:
All asserts fails here as members are instances of
Member
and notUsuario
. If I use this instead:users are of instance
Usuario
in the mainOrganizacion
but not in it's children.Any ideas? Thank you!