title: How to marshal nested attribute up to the schema?
body: <p>I have a project with articles having different prices depending on their location.</p>
  
  <p>The <code>Article</code> and <code>ArticlePrice</code> models are as follow:</p>
  
  <pre><code>from flask_sqlalchemy import SQLAlchemy
  from sqlalchemy.orm import relationship
  
  db = SQLAlchemy()
  
  class Article(db.Model):
      __tablename__ = 'article'
  
      id = db.Column(db.Integer, primary_key=True)
      title = db.Column(db.String(255), nullable=False)
      description = db.Column(db.Text)
      prices = relationship("ArticlePrice")
  
  class ArticlePrice(db.Model):
      __tablename__ = 'article_prices'
  
      id = db.Column(db.Integer, primary_key=True)
      article_id = db.Column(db.Integer, db.ForeignKey("article.id"), nullable=False)
      location_id = db.Column(db.Integer, db.ForeignKey("location.id"), nullable=False)
      price = db.Column(db.Integer, nullable=False)
      location = relationship('Location')
  </code></pre>
  
  <p>I don't want to return all the prices of an article to the client but just <em>his</em> location price. Such as he receives a JSON like:</p>
  
  <pre><code>{
    id: '',
    title: '',
    description: '',
    price: 0
  }
  </code></pre>
  
  <p>So my schema looks like this now:</p>
  
  <pre><code>article = namespace.model('Article', {
      'id': fields.Integer(required=True),
      'title': fields.String(required=True),
      'description': fields.String(required=True),
      'price': fields.Integer(attribute=lambda x: x.prices[0].price), # This one works
  })
  </code></pre>
  
  <p><strong>This is working fine</strong> with a <strong>lambda expression</strong>, but in the documentation (<a href="http://flask-restful.readthedocs.io/en/0.3.6/fields.html#renaming-attributes" rel="nofollow noreferrer">flask-restful</a> and <a href="http://flask-restplus.readthedocs.io/en/stable/marshalling.html#renaming-attributes" rel="nofollow noreferrer">flask-restplus</a>) they talk about another way, but I can't make it work as follow:</p>
  
  <pre><code>'price': fields.Integer(attribute='prices[0].price') # This one doesn't work
  </code></pre>
  
  <p>What am I missing? Why is the last syntax not working? Did I misunderstand this syntax use?</p>