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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:24:17+00:00 2026-06-06T05:24:17+00:00

I am using appengine webapp2 as wsgihandler, jinja2 as the template engine and wtforms

  • 0

I am using appengine webapp2 as wsgihandler, jinja2 as the template engine and wtforms as the form module for its support to app engine models.

Following is my simple model:

class TaskCategory(db.Model):
    title = db.StringProperty()
    description = db.TextProperty()


class TaskList(db.Model):
    title = db.StringProperty()
    description = db.TextProperty()
    category = db.ReferenceProperty(TaskCategory)
    start_date = db.DateProperty()
    target_finish_date = db.DateProperty()

Inside my handlers i write stuff as follows:

from wtforms.ext.appengine.db import model_form

model_dict = {'category': TaskCategory,
          'task': TaskList}

class CreateForm(webapp2.RequestHandler):
    def get(self, slug):
        form = model_form(model_dict[slug]) # slug can either be category or task.
        self.render_template('index.html', {'form': form()})

Following is my template:

<form method="POST" action""> 
  <table>
  {% for field in form %}   

    <tr>{{ field.label }}</tr>
    <tr>{{ field()|safe }}</tr>

  <tr>
    {% if field.errors %}
    <td>
      <ul class=errors>
        {% for error in field.errors %}
        <li>{{ error }}</li>
        {% endfor %}
      </ul>
    </td>
    {% endif %}
    {% endfor %}
    </table>
    <input type="submit" class="btn"  value="Submit Form"/>
</form>

Everything renders perfectly in the template, except the dropdown for the foreign key the values listed over there are something like:

    <tr><label for="category">Category</label></tr>
     <tr><select id="category" name="category"><option selected value="__None"></option><option value="ahhkZXZ-bmV3LXByb2plY3QtdGVtcGxhdGVyEgsSDFRhc2tDYXRlZ29yeRgCDA">&lt;models.TaskCategory object at 0xb22d74c&gt;</option>

<option value="ahhkZXZ-bmV3LXByb2plY3QtdGVtcGxhdGVyEgsSDFRhc2tDYXRlZ29yeRgDDA">&lt;models.TaskCategory object at 0xb22dbec&gt;</option>

<option value="ahhkZXZ-bmV3LXByb2plY3QtdGVtcGxhdGVyFgsSDFRhc2tDYXRlZ29yeSIEdGVzdAw">&lt;models.TaskCategory object at 0xb22d74c&gt;</option></select></tr>

As is visible the names are not being displayed for the category, instead the objects are displayed, how can i rectify it, in a generic manner?

  • 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-06T05:24:19+00:00Added an answer on June 6, 2026 at 5:24 am

    Well this has got nothing to do with, WTForm or jinja or webapp2.
    Change your database file to return the title in your case, instead of the object using repr as follows:

    class TaskCategory(db.Model):
        title = db.StringProperty()
        description = db.TextProperty()
    
        def __repr__(self):
            return unicode(self.title)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using google app engine in python with a Jinja2 template engine. This
I am using appengine, webapp2 framework. I have the following model: class Match(db.Model): date_time
I am uisng webapp2 on google app engine my database model has the following
I have problem with using template in Google App Engine by Python. the thing
I'm using the latest version of Google App Engine, Python 2.7 and webapp2, but
I'm building my new website using app-engine with python and webapp2 I'm having hard
I am writing a python program for google appengine using jinja2 as my template
I am using the webapp2 framework on Google App Engine, and I'm getting a
I think I'm using Django in google app engine this way: from google.appengine.ext.webapp import
I'm developing software on google app engine. I'm using the webapp framework. is there

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.