(text, href, **kwargs)
return wrapper
转化为a标签
转化为a标签
转化为a标签
def anchor(text, href, **kwargs):
    """转化为a标签"""
    @mark_safe
    def wrapper(modeladmin, obj):
        kwargs.update(
            href=href,
            text=text
        )
        for key, value in kwargs.items():
            if callable(value):
                kwargs[key] = value(modeladmin, obj)
        return kwargs["text"] and '<a href="{href}">{text}</a>'.format(**kwargs)
    return wrapper
def anchor ( text , href , * * kwargs ) : @ mark_safe def wrapper ( modeladmin , obj ) : kwargs . update ( href = href , text = text ) for key , value in kwargs . items ( ) : if callable ( value ) : kwargs [ key ] = value ( modeladmin , obj ) return kwargs [ "text" ] and '<a href="{href}">{text}</a>' . format ( * * kwargs ) return wrapper