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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:44:51+00:00 2026-06-17T18:44:51+00:00

I am having a problem with appengine that I can’t seem to figure out:

  • 0

I am having a problem with appengine that I can’t seem to figure out:

from google.appengine.ext import ndb
from google.appengine.ext.ndb import polymodel

class Item(polymodel.PolyModel):
      name = ndb.StringProperty()
      type = ndb.StringProperty(choices=["Medical","Food"])
      sub_category_type = ndb.StringProperty()
      sub_category_sub_type = ndb.StringProperty()

class MedicalItem(Item):
      med_sub_type = ndb.StringProperty()
      can_split_item = ndb.BooleanProperty()

class ItemInHouse(ndb.Model):
      item = ndb.StructuredProperty(Item)
      amount_of_item = ndb.FloatProperty()

So using the classes above, when I query for all ItemInHouse, and then I try to access those iteminhouse that have a MedicalItem, I am unable to get med_sub_type. That is:

itms = ItemInHouse.query(ItemInHouse.item.type == "Medical").fetch()
for itm in itms:
    self.response.out.write(itm.item.med_sub_type)

Throws an error at the itm.item.med_sub_type. I have even tried: itm.item._values["med_sub_type"].b_val but this still throws an AttributeError: ‘Item’ object has no attribute ‘med_sub_type’. I do see in the class_ property it has Item and MedicalItem properties, but I am unable to acces it. Any ideas?

Thanks
Jon

  • 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-17T18:44:52+00:00Added an answer on June 17, 2026 at 6:44 pm

    I fear that what you are trying to do may not be possible — I don’t think I had anticipated storing PolyModel instances as StructuredProperty values. Does that explain what you are seeing? You may want to file a feature request at the NDB item tracker but I can’t promise it will be implemented.

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

Sidebar

Related Questions

-- EDIT -- Worth to point out. While having a problem with different homework
I've spent some time on Google and SO trying to figure this out and
I am having a curious problem that perhaps someone has insight into. I encode
I'm having a bit of trouble figuring out something that should be simple. I
I am having a slight problem with the appengine SDK. When I close it,
I'm having a problem getting any response from urlfetch.Transport.RoundTrip in GAE Go. When I
I have the presumably common problem of having elements that I wish to place
I'm using django with app-engine-patch and I'm having this wierd problem running manage.py dumpdata
I am having problems while saving a pre-persisted JDO object in google-app-engine data store.
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how

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.