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

  • SEARCH
  • Home
  • 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 1055075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:30:23+00:00 2026-05-16T17:30:23+00:00

I query an array of objects from DB, then compare addresses of the objects

  • 0

I query an array of objects from DB, then compare addresses of the objects in Model and in View. They differs! Why? I want access the same objects as from template as from business logics code.

I wouldn’t ask for it but it really bother me because function calls are disallowed in Django-styled templates and I even can’t assign custom properties to DB-objects within the business logics code.

In request handler:

from google.appengine.ext.webapp import template

cats = db.GqlQuery("SELECT * FROM Cats")
for cat in cats:
  self.response.out.write("<li>%s</li>" % (a))

In template:

{% for a in articles %}
  {{a}},
{% endfor %}

Addresses (hash codes) differs in such code.

  • 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-16T17:30:24+00:00Added an answer on May 16, 2026 at 5:30 pm

    When you use the query iterator, you in fact do several fetches in sequence, each one will result in a new model instance.

    Instead of doing:

    cats = db.GqlQuery("SELECT * FROM Cats")
    for cat in cats:
        ...
    

    …do this instead:

    cats = db.GqlQuery("SELECT * FROM Cats").fetch(50)
    for cat in cats:
        ...
    

    And pass the list of cats to the template. You will have same lists in handler and template, as each entity is loaded into a model instance only once.

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

Sidebar

Related Questions

I've retrieved a series of objects from the Twitter API, and I want to
I have a situation where I want to fetch objects from my core data
This query works great: var pageObject = (from op in db.ObjectPermissions join pg in
A query runs fast: DECLARE @SessionGUID uniqueidentifier SET @SessionGUID = 'BCBA333C-B6A1-4155-9833-C495F22EA908' SELECT * FROM
I've been learning about the Model-View-Controller paradigm (MVC), but I'm quite confused since some
I am using JDBC to query a MySQL database for specific records from two
Is there a standard way to bind arrays (of scalars) in a SQL query?
Query parameters : http://example.com/apples?order=random&color=blue Matrix parameters : http://example.com/apples;order=random;color=blue When should one use query parameters
The Query Optimizer is estimating that the results of a join will have only
A query that is used to loop through 17 millions records to remove duplicates

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.