I am having difficulty over generating api endpoint urls in nested output fields using [Flask-RESTful][1].
I found that fields.Url(\'my_endpoint\', absolute=Tr
The problem was fields.Url
needs a required endpoint parameter, In this case its username
.
The parameter username
is available to user_fields
with the returned user
object, but the role
object user.role
does not contain username
attribute.
So I assigned 'usernameattribute to
user.role` object before returning it.
user = get_user(username) #Get user object from db
user.role.username = user.username
return user