Python rest_framework.serializers.URLField() Examples
The following are 2
code examples of rest_framework.serializers.URLField().
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: test_field_converter.py From graphene-django with MIT License | 5 votes |
def test_should_url_convert_string(): assert_conversion(serializers.URLField, graphene.String)
Example #2
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")