parameters: (user, invite_data)
docstring: Assigns roles to the user based on the information found in the invitation link
docstring_summary: Assigns roles to the user based on the information found in the invitation link
docstring_tokens: Assigns roles to the user based on the information found in the invitation link
function: def assign_invitation(user, invite_data):
      """
      Assigns roles to the user based on the information found in the invitation link
      """
      if user.email != invite_data['email']:
          return
  
      books = Book.objects.filter(pk__in=invite_data['book_ids'])
      roles = Role.objects.filter(pk__in=invite_data['role_ids'])
  
      for book in books:
          for role in roles:
              book_role, _ = BookRole.objects.get_or_create(role=role, book=book)
              book_role.members.add(user)
function_tokens: def assign_invitation ( user , invite_data ) : if user . email != invite_data [ 'email' ] : return books = Book . objects . filter ( pk__in = invite_data [ 'book_ids' ] ) roles = Role . objects . filter ( pk__in = invite_data [ 'role_ids' ] ) for book in books : for role in roles : book_role , _ = BookRole . objects . get_or_create ( role = role , book = book ) book_role . members . add ( user )