def clean_user(self):
        user = self.cleaned_data['user']
        if user and self.team.members.filter(user=user).exists():
            raise forms.ValidationError(
                "%s is already a member of the team" % user.username)
        return user
dataset/ETHPy150Open mvantellingen/localshop/localshop/apps/accounts/forms.py/TeamMemberAddForm.clean_user/original