diff --git a/apps/teams/views.py b/apps/teams/views.py index 681c943..ad58795 100644 --- a/apps/teams/views.py +++ b/apps/teams/views.py @@ -275,12 +275,12 @@ def bulk_create(self, request, *args, **kwargs): }) user_emails = [item['email'] for item in serializer.validated_data] if Membership.objects.filter(user__email__in=user_emails, team=team).count() > 0: - emails = [member.user.email for user in Membership.objects.filter( + emails = [member.user.email for member in Membership.objects.filter( user__email__in=user_emails, team=team).select_related('user')] email_str = ", ".join(emails) raise DRFValidationError({ "code": "E02", - "message": f"User with email ({email_str}) already exists" + "message": f"Member with email ({email_str}) already exists" }) for item in serializer.validated_data: