Hello people, I'm trying to get acquainted with GAE, and I'm stuck on
one simple problem:
I've got two classes in datastore: Category and Product:

class Category(db.Model):
  name = db.StringProperty()

class Product(db.Model):
  name = db.StringProperty()
  shortdesc = db.TextProperty()
  longdesc = db.TextProperty()
  components = db.TextProperty()
  image = db.BlobProperty()
  thumbnail = db.BlobProperty()
  category = db.ReferenceProperty(categories.Category)

When I'm editing product, in the form I do <select> to choose
category:

<select name='category'>
                {% for cat in categories %}
                        <option value='{{ cat.key }}'>{{ cat.name }}</option>
                {% endfor %}
</select>

BTW,
1. self.template_values['categories']=categories.Category().all().order
('name')
2. Codepage is utf-8

The problem is: when I'm posting product information, category ID is
not found. Printing catid shows correct ID, but query:
  catid=self.request.str_POST['category']
  cats=categories.Category.all().filter('__key__=',db.Key(catid))
returns 0 objects. "catid.decode('utf-8') doesn't help either.

Can anyone help me this? Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to