コード例 #1
0
def set_display_name(user_id, prefix, suffix):
    # get the current name
    old_display_name = get_EnkiUserDisplayName_by_user_id_current(user_id)
    # save the new name
    display_name = EnkiModelDisplayName(parent=ndb.Key(EnkiModelUser, user_id),
                                        user_id=user_id,
                                        prefix=prefix,
                                        suffix=suffix)
    display_name.put()
    if old_display_name:
        # if the user already had a display name, and a new same was set, set the old name to not current
        old_display_name.current = False
        old_display_name.put()