invenio_groups/models.py
def create(cls, group, user, state=MembershipState.ACTIVE):
        """Create a new membership."""
        with db.session.begin_nested():
            membership = cls(
                user_id=user.get_id(),
                id_group=group.id,
                state=state,
            )
            db.session.add(membership)
        return membership
def create(cls, group, user, state=MembershipState.ACTIVE):
        """Create a new membership."""
        with db.session.begin_nested():
            membership = cls(
                user_id=user.get_id(),
                id_group=group.id,
                state=state,
            )
            db.session.add(membership)
        return membership
def create ( cls , group , user , state = MembershipState . ACTIVE ) : with db . session . begin_nested ( ) : membership = cls ( user_id = user . get_id ( ) , id_group = group . id , state = state , ) db . session . add ( membership ) return membership
Create a new membership.
Create a new membership .