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

Method validate

api/organisations/serializers.py:173–181  ·  view source on GitHub ↗
(self, attrs)

Source from the content-addressed store, hash-verified

171 return {"invites": [InviteSerializerFull(invite).data for invite in instance]}
172
173 def validate(self, attrs): # type: ignore[no-untyped-def]
174 for email in attrs.get("emails", []):
175 if Invite.objects.filter( # type: ignore[misc]
176 email=email, organisation__id=self.context.get("organisation")
177 ).exists():
178 raise serializers.ValidationError(
179 {"emails": "Invite for email %s already exists" % email}
180 )
181 return super(MultiInvitesSerializer, self).validate(attrs)
182
183 def _get_invited_by(self): # type: ignore[no-untyped-def]
184 return self.context.get("request").user if self.context.get("request") else None # type: ignore[union-attr]

Callers

nothing calls this directly

Calls 3

existsMethod · 0.80
getMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected