Commit 2d47821b authored by 段英荣's avatar 段英荣

modify

parent 12f3c731
......@@ -37,10 +37,9 @@ class User(models.Model):
@classmethod
def get_user_nick_name(cls,user_id):
try:
nick_name_obj = User.objects.using(settings.SLAVE_DB_NAME).filter(user_id=user_id).values_list("nick_name").first()
nick_name = User.objects.using(settings.SLAVE_DB_NAME).filter(user_id=user_id).values_list("nick_name").first()
nick_name = nick_name_obj.nick_name if nick_name_obj else ""
return nick_name
return nick_name[0]
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment