def username_or(user, attr):
    """
    Returns the user's username for display, or an alternate attribute
    if ``ACCOUNTS_NO_USERNAME`` is set to ``True``.
    """
    if not settings.ACCOUNTS_NO_USERNAME:
        attr = "username"
    value = getattr(user, attr)
    if callable(value):
        value = value()
    return value
def username_or ( user , attr ) : if not settings . ACCOUNTS_NO_USERNAME : attr = "username" value = getattr ( user , attr ) if callable ( value ) : value = value ( ) return value
Returns the user's username for display, or an alternate attribute
    if ``ACCOUNTS_NO_USERNAME`` is set to ``True``.