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 8845287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:42:07+00:00 2026-06-14T11:42:07+00:00

On Google app engine, I’d like to use two variables in a template for

  • 0

On Google app engine, I’d like to use two variables in a template for loop: I need to input, say, 10 items. If there are already some items in the datastore, then show them, otherwise, leave the field blank. How do I do it? Thanks.

BTW, I noticed that there is “multifor” in Django, but I don’t know how to install it on GAE.

main.py:

def mainPage(webapp2.RequestHandler):
    query = db.Query(Item)
    items = query.fetch(limit=10)
    template_values = {'range': range(10), 'items': items}
    common.render(handler, 'main.html', template_values)

main.html:

<form action=... method="post">
      {% for i in range; for item in items %}
        <input type="text" name="name" value="item.name">
      {% endfor %}
      <input type="submit">
</form>
  • 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-06-14T11:42:09+00:00Added an answer on June 14, 2026 at 11:42 am

    Not sure which templating engine you are using, but what about creating a list of 10-elements and filling it with the results of your query? Something like:

    my_list = [None for _ in range(10)]
    

    Then, once you get your query results, add them to the list (the objects will be returned as a list of objects, so this is just a conceptual example):

    >>> new_list = ['one', 'two', 'three']
    >>> my_list[:len(new_list)] = new_list
    >>> my_list
    ['one', 'two', 'three', None, None, None, None, None, None, None]
    

    Now when you pass my_list into the template:

    <form action=... method="post">
          {% for item in my_list %}
            {% if item %}
               <input type="text" name="name" value="item.name">
            {% else %}
               <input type="text" name="<your_blank_value>" value="<your_blank>">
            {% endif %}
          {% endfor %}
          <input type="submit">
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On Google App Engine to query the data store with Python, one can use
Since Google App Engine is a PaaS does it use any hypervisor? it is
can Google App Engine be used to store and serve large files like audible
With google app engine, is there a way to send a text message from
Google App engine documentation states that it is possible to upload and use third
Google App Engine limits urlfetch.fetch() responses to 1MB . Is there any workaround of
Google App Engine has two methods for running jobs at some later point, Task
In Google App Engine, for a task like scanning some RSS feeds and adding
In google app engine certain html tags are stripped out like tr, table an
In Google App Engine, GQL(an SQL-like query mechanism foe datastore) is available only for

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.