MCPcopy Index your code
hub / github.com/Flagsmith/flagsmith / validate

Method validate

api/organisations/serializers.py:129–136  ·  view source on GitHub ↗
(self, attrs: typing.Any)

Source from the content-addressed store, hash-verified

127 read_only_fields = ("id", "date_created")
128
129 def validate(self, attrs: typing.Any) -> typing.Any:
130 if Invite.objects.filter(
131 email=attrs["email"], organisation__id=self.context["organisation"]
132 ).exists():
133 raise serializers.ValidationError(
134 {"email": "Invite for email %s already exists" % attrs["email"]}
135 )
136 return super(InviteSerializer, self).validate(attrs)
137
138
139class MultiInvitesSerializer(serializers.Serializer): # type: ignore[type-arg]

Callers 1

validateMethod · 0.45

Calls 1

existsMethod · 0.80

Tested by

no test coverage detected