if employee.new_gender.name in ("男", "Male", "male"): result = "先生" elif employee.new_gender.name in ("女", "Female", "female"): result = "女士" else: result = "先生/女士"
根据性别字段,当性别为男时显示为先生,当性别为女时显示为女士