I want to allow both flutterdemo.hp.com and 12.135.720.12 in django field.
This is what i tried.
from rest_framework import serializers, viewsets
from django.core.validators import URLValidator
class FlutterSerializer(serializers.HyperlinkedModelSerializer):
fqdn_ip = serializers.CharField(max_length = 100, validators =[URLValidator])
But it is allowing all the text and just working as CharFiled. URLField is treating "flutterdemo.hp.com" as invalid.
How can i achieve this? Thanks,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.