django.core.validators - python examples

Here are the examples of the python api django.core.validators taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

3 View Complete Implementation : settings.py
Copyright MIT License
Author : hugobessa
def is_url(context, value, original_value):
    from django.core.validators import URLValidator
    from django.core.exceptions import ValidationError
    from django.utils.text import ugettext_lazy as _
    validate_url = URLValidator()
    try:
        validate_url(value)
    except ValidationError as e:
        raise ValidationError(_('This field must be a valid url'))
    return value