(s)
return ''.join(res)
Ensure that primary key values do not confuse the admin URLs by escaping
    any '/', '_' and ':' and similarly problematic characters.
    Similar to urllib.quote, except that the quoting is slightly different so
    that it doesn't get automatically unquoted by the Web browser.

    This is adopted from the Django core. django-admin2 mandates that code
    doesn't depend on imports from django.contrib.admin.

    https://github.com/django/django/blob/1.9.6/django/contrib/admin/utils.py#L66-L73
Ensure that primary key values do not confuse the admin URLs by escaping
    any '/', '_' and ':' and similarly problematic characters.
    Similar to urllib.quote, except that the quoting is slightly different so
    that it doesn't get automatically unquoted by the Web browser.
Ensure that primary key values do not confuse the admin URLs by escaping any / _ and : and similarly problematic characters . Similar to urllib . quote except that the quoting is slightly different so that it doesn t get automatically unquoted by the Web browser .
def quote(s):
    """
    Ensure that primary key values do not confuse the admin URLs by escaping
    any '/', '_' and ':' and similarly problematic characters.
    Similar to urllib.quote, except that the quoting is slightly different so
    that it doesn't get automatically unquoted by the Web browser.

    This is adopted from the Django core. django-admin2 mandates that code
    doesn't depend on imports from django.contrib.admin.

    https://github.com/django/django/blob/1.9.6/django/contrib/admin/utils.py#L66-L73
    """
    if not isinstance(s, str):
        return s
    res = list(s)
    for i in range(len(res)):
        c = res[i]
        if c in """:/_#?;@&=+$,"[]<>%\n\\""":
            res[i] = '_%02X' % ord(c)
    return ''.join(res)
def quote ( s ) : if not isinstance ( s , str ) : return s res = list ( s ) for i in range ( len ( res ) ) : c = res [ i ] if c in """:/_#?;@&=+$,"[]<>%\n\\""" : res [ i ] = '_%02X' % ord ( c ) return '' . join ( res )