I am attempting to clear all the users from a table called Team based on two factors:
team_id- a custom variable in the user profile called
level
Bellow is my current effort, I am well aware this is does not work but at least it’s a starting point.
team = Team.objects.get(pk = team_id)
team_user_list = team.users.all().filter(userprofile__level = 1)
team_user_list.users.clear()
Note: I don’t want to delete the users, simply remove them from the team table.
team_user_listis queryset, so it doesn’t haveusersattribute. Try