title: How to access items in a model with ReferenceProperty?
body: <p>This is a follow up on <a href="https://stackoverflow.com/questions/4294562/how-to-query-datastore-when-using-referenceproperty">my previous question</a>.</p>
  
  <p>I set up the models with ReferenceProperty:</p>
  
  <pre><code>class User(db.Model):
      userEmail = db.StringProperty()
  
  class Comment(db.Model):
      user = db.ReferenceProperty(User, collection_name="comments")
      comment = db.StringProperty(multiline=True)
  
  class Venue(db.Model):
      user = db.ReferenceProperty(User, collection_name="venues")
      venue = db.StringProperty()
  </code></pre>
  
  <p>In datastore I have this entry under User:</p>
  
  <pre><code>Entity Kind: User
  Entity Key: ag1oZWxsby0xLXdvcmxkcgoLEgRVc2VyGBUM
  ID: 21
  userEmail: az@example.com
  </code></pre>
  
  <p>And under Venue:</p>
  
  <pre><code>Entity Kind: Venue
  Entity Key: ag1oZWxsby0xLXdvcmxkcgsLEgVWZW51ZRhVDA
  ID: 85
  venue (string): 5 star venue
  user (Key): ag1oZWxsby0xLXdvcmxkcgoLEgRVc2VyGBUM
  User: id=21
  </code></pre>
  
  <p>I am trying to display the item in <code>hw.py</code> like this</p>
  
  <pre><code>query = User.all()
      results = query.fetch(10)
      self.response.out.write("&lt;html&gt;&lt;body&gt;&lt;ol&gt;")
      for result in results:
          self.response.out.write("&lt;li&gt;")
          self.response.out.write(result.userEmail)
          self.response.out.write(result.venues)
          self.response.out.write("&lt;/li&gt;")
      self.response.out.write("&lt;/ol&gt;&lt;/body&gt;&lt;/html&gt;")
  </code></pre>
  
  <p>This line works:</p>
  
  <pre><code>        self.response.out.write(result.userEmail)
  </code></pre>
  
  <p>But this line does not work:</p>
  
  <pre><code>        self.response.out.write(result.venues)
  </code></pre>
  
  <p>But as <a href="https://stackoverflow.com/questions/4294562/how-to-query-datastore-when-using-referenceproperty/4294641#4294641">per vonPetrushev's answer</a> <code>result.venues</code> should grab the <code>venue</code> associated with this <code>userEmail</code>.</p>
  
  <p>Sorry if this is confusing: I am just trying to access the tables linked to the <code>userEmail</code> with <code>ReferenceProperty</code>. The linked tables are <code>Venue</code> and <code>Comment</code>. How do I access an item in <code>Venue</code> or in <code>Comment</code>? Thanks.</p>