Python django.db.models.URLField() Examples
The following are 8
code examples of django.db.models.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
django.db.models
, or try the search function
.
Example #1
Source File: abstract.py From django-peeringdb with Apache License 2.0 | 5 votes |
def __init__(self, *args, **kwargs): kwargs["max_length"] = 255 super(URLField, self).__init__(*args, **kwargs)
Example #2
Source File: concrete.py From django-peeringdb with Apache License 2.0 | 5 votes |
def __init__(self, *args, **kwargs): kwargs["max_length"] = 255 super(URLField, self).__init__(*args, **kwargs)
Example #3
Source File: test_converter.py From graphene-django with MIT License | 5 votes |
def test_should_url_convert_string(): assert_conversion(models.URLField, graphene.String)
Example #4
Source File: tests.py From django-sqlserver with MIT License | 5 votes |
def test_url_field(self): field = models.URLField() name, path, args, kwargs = field.deconstruct() self.assertEqual(path, "django.db.models.URLField") self.assertEqual(args, []) self.assertEqual(kwargs, {}) field = models.URLField(max_length=231) name, path, args, kwargs = field.deconstruct() self.assertEqual(path, "django.db.models.URLField") self.assertEqual(args, []) self.assertEqual(kwargs, {"max_length": 231})
Example #5
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_url_field(self): field = models.URLField() name, path, args, kwargs = field.deconstruct() self.assertEqual(path, "django.db.models.URLField") self.assertEqual(args, []) self.assertEqual(kwargs, {}) field = models.URLField(max_length=231) name, path, args, kwargs = field.deconstruct() self.assertEqual(path, "django.db.models.URLField") self.assertEqual(args, []) self.assertEqual(kwargs, {"max_length": 231})
Example #6
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_url_field(self): field = models.URLField() name, path, args, kwargs = field.deconstruct() self.assertEqual(path, "django.db.models.URLField") self.assertEqual(args, []) self.assertEqual(kwargs, {}) field = models.URLField(max_length=231) name, path, args, kwargs = field.deconstruct() self.assertEqual(path, "django.db.models.URLField") self.assertEqual(args, []) self.assertEqual(kwargs, {"max_length": 231})
Example #7
Source File: fields.py From maas with GNU Affero General Public License v3.0 | 5 votes |
def to_python(self, value): # Call grandparent method (CharField) to get string value. value = super(forms.URLField, self).to_python(value) # If it's a PPA locator, return it, else run URL pythonator. match = re.search(URLOrPPAValidator.ppa_re, value) return value if match else super().to_python(value)
Example #8
Source File: fields.py From maas with GNU Affero General Public License v3.0 | 5 votes |
def formfield(self, **kwargs): defaults = {"form_class": URLOrPPAFormField} defaults.update(kwargs) return super(URLField, self).formfield(**defaults)