(field, model=None)
Given a field, will check if it's a URLField or not.
        If model is given, field is actually a field_name and field must first be retrieved.
Given a field, will check if it's a URLField or not.
        If model is given, field is actually a field_name and field must first be retrieved.
Given a field will check if it s a URLField or not . If model is given field is actually a field_name and field must first be retrieved .
def is_urlfield(field, model=None):
    """
        Given a field, will check if it's a URLField or not.
        If model is given, field is actually a field_name and field must first be retrieved.
    """
    if model:
        try:
            field = model._meta.get_field(field)
        except FieldDoesNotExist:
            return False
    try:
        return field.default_validators[0].regex == URLValidator.regex
    except AttributeError:
        return False
    except IndexError:
        return False
def is_urlfield ( field , model = None ) : if model : try : field = model . _meta . get_field ( field ) except FieldDoesNotExist : return False try : return field . default_validators [ 0 ] . regex == URLValidator . regex except AttributeError : return False except IndexError : return False