Example #1
0
def get_username(user, context=None):
    username = cleansed_username(user)
    if "." in username:
        sso_me = sso.get_logged_in_user_details(context)
        if sso_me:
            return f"{sso_me.get('first_name', '')} {sso_me.get('last_name', '')}"
    return username
Example #2
0
 def to_representation(self, value):
     return {
         "id": value.id,
         "name": cleansed_username(value),
     }
Example #3
0
 def _cleansed_username(self, user):
     return cleansed_username(user)
Example #4
0
    def _format_user(self, user):
        if user is not None:
            return {"id": user.id, "name": cleansed_username(user)}

        return None
Example #5
0
 def get_full_name(self, obj):
     return cleansed_username(obj)