Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created August 25, 2020 06:10
Show Gist options
  • Save velotiotech/e2d8deff68d4beef99f1c2c1aafb7533 to your computer and use it in GitHub Desktop.
Save velotiotech/e2d8deff68d4beef99f1c2c1aafb7533 to your computer and use it in GitHub Desktop.
# read the context data in the serializer validation method
class UserSerializer(serializer.Serializer):
def validate_email(self, val):
valid_domains = serf.context.get("valid_domains")
# main validation logic goes here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment