Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3486316
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:00:56+00:00 2026-05-18T11:00:56+00:00

This is a follow up on my previous question . I set up the

  • 0

This is a follow up on my previous question.

I set up the models with ReferenceProperty:

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()

In datastore I have this entry under User:

Entity Kind: User
Entity Key: ag1oZWxsby0xLXdvcmxkcgoLEgRVc2VyGBUM
ID: 21
userEmail: az@example.com

And under Venue:

Entity Kind: Venue
Entity Key: ag1oZWxsby0xLXdvcmxkcgsLEgVWZW51ZRhVDA
ID: 85
venue (string): 5 star venue
user (Key): ag1oZWxsby0xLXdvcmxkcgoLEgRVc2VyGBUM
User: id=21

I am trying to display the item in hw.py like this

query = User.all()
    results = query.fetch(10)
    self.response.out.write("<html><body><ol>")
    for result in results:
        self.response.out.write("<li>")
        self.response.out.write(result.userEmail)
        self.response.out.write(result.venues)
        self.response.out.write("</li>")
    self.response.out.write("</ol></body></html>")

This line works:

        self.response.out.write(result.userEmail)

But this line does not work:

        self.response.out.write(result.venues)

But as per vonPetrushev’s answer result.venues should grab the venue associated with this userEmail.

Sorry if this is confusing: I am just trying to access the tables linked to the userEmail with ReferenceProperty. The linked tables are Venue and Comment. How do I access an item in Venue or in Comment? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:00:57+00:00Added an answer on May 18, 2026 at 11:00 am

    venues is actually a query object. So you’ll need to fetch or iterate over it.

    Try replacing the self.response.out.write(result.venues) line with a loop:

    query = User.all()
    users = query.fetch(10)
    self.response.out.write("<html><body><ol>")
    for user in users:
        self.response.out.write("<li>")
        self.response.out.write(user.userEmail)
        self.response.out.write("<ul>")
        # Iterate over the venues
        for venue in user.venues:
            self.response.out.write("<li>%s</li>" % venue.venue)
        self.response.out.write("</ul></li>")
    self.response.out.write("</ol></body></html>")
    

    However, this will not scale very well. If there are 10 users, it will run 11 queries! Make sure you are using Appstats to look for performance issues like these. Try to minimize the number of RPC calls you make.

    A better solution might be to denormalize and store the user’s email on the Venue kind. That way you will only need one query to print the venue information and users email.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a follow-up to a previous question I had about interfaces. I received
This question is a follow up to my previous question about getting the HTML
This is a follow up to my previous question: Problem passing parameters via Iframe
This is a follow-up on a previous question I had ( Complexity of STL
This is a follow-up on my previous question . Once I got the problem
This is a follow up to a previous question that I had before about
All, this is a follow up from a previous question here: C# formatting external
Note: This is a follow-up to an answer on a previous question . I'm
This is a follow up post of my previous question about BASIC auth over
This is a follow up to a previous question . if I have multiple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.