Python rest_framework.serializers.EmailField() Examples
The following are 4
code examples of rest_framework.serializers.EmailField().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
rest_framework.serializers
, or try the search function
.
Example #1
Source File: serializers.py From djoser with MIT License | 5 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.email_field = get_user_email_field_name(User) self.fields[self.email_field] = serializers.EmailField()
Example #2
Source File: test_field_converter.py From graphene-django with MIT License | 5 votes |
def test_should_email_convert_string(): assert_conversion(serializers.EmailField, graphene.String)
Example #3
Source File: test_drf.py From pydantic with MIT License | 5 votes |
def __init__(self, allow_extra): class Model(serializers.Serializer): id = serializers.IntegerField() client_name = serializers.CharField(max_length=255, trim_whitespace=False) sort_index = serializers.FloatField() # client_email = serializers.EmailField(required=False, allow_null=True) client_phone = serializers.CharField(max_length=255, trim_whitespace=False, required=False, allow_null=True) class Location(serializers.Serializer): latitude = serializers.FloatField(required=False, allow_null=True) longitude = serializers.FloatField(required=False, allow_null=True) location = Location(required=False, allow_null=True) contractor = serializers.IntegerField(required=False, allow_null=True, min_value=0) upstream_http_referrer = serializers.CharField( max_length=1023, trim_whitespace=False, required=False, allow_null=True ) grecaptcha_response = serializers.CharField(min_length=20, max_length=1000, trim_whitespace=False) last_updated = serializers.DateTimeField(required=False, allow_null=True) class Skill(serializers.Serializer): subject = serializers.CharField() subject_id = serializers.IntegerField() category = serializers.CharField() qual_level = serializers.CharField() qual_level_id = serializers.IntegerField() qual_level_ranking = serializers.FloatField(default=0) skills = serializers.ListField(child=Skill()) self.allow_extra = allow_extra # unused self.serializer = Model
Example #4
Source File: validator_factory.py From drf-typed-views with MIT License | 4 votes |
def make_string_validator(cls, settings: ParamSettings): if settings.regex: return serializers.RegexField( settings.regex, default=settings.default, max_length=settings.max_length, min_length=settings.min_length, ) if settings.format is None: return serializers.CharField( default=settings.default, max_length=settings.max_length, min_length=settings.min_length, trim_whitespace=settings.trim_whitespace, ) if settings.format == "email": return serializers.EmailField( default=settings.default, max_length=settings.max_length, min_length=settings.min_length, ) if settings.format == "slug": return serializers.SlugField( default=settings.default, max_length=settings.max_length, min_length=settings.min_length, ) if settings.format == "url": return serializers.URLField( default=settings.default, max_length=settings.max_length, min_length=settings.min_length, ) if settings.format == "uuid": return serializers.UUIDField(default=settings.default) if settings.format == "file_path": return serializers.FilePathField( default=settings.default, path=settings.path, match=settings.match, recursive=settings.recursive, allow_files=settings.allow_files, allow_folders=settings.allow_folders, ) if settings.format == "ipv6": return serializers.IPAddressField(default=settings.default, protocol="IPv6") if settings.format == "ipv4": return serializers.IPAddressField(default=settings.default, protocol="IPv4") if settings.format == "ip": return serializers.IPAddressField(default=settings.default, protocol="both")