Problem comparing keys in Appengine/Python

Posted by ana on Stack Overflow See other posts from Stack Overflow or by ana
Published on 2010-04-30T05:52:44Z Indexed on 2010/04/30 5:57 UTC
Read the original article Hit count: 419

Filed under:
|
|
|

I'm trying to create a relationship between "tables" with Appengine/Python. Imagine I have a "table" for items, and a table for colors. I save the color of an item by saving the color key as an atribute of the item.

That's working well, but this particular piece of code is not working:

<select id="colorKey" name="colorKey">
  {% for color in colors %}
    <option value="{{ color.key }}"{% if color.key = item.colorKey %} selected="selected"{% endif %}>
      {{ color.name }} - {{ item.colorKey }} - {{ color.key }}
    </option>
  {% endfor %}
</select>

Since the {{ item.colorKey }} and {{ color.key }} variables are actually the same chain of characters, I only can think in a problem with the types.

{{ item.colorKey }} is a string for sure. But maybe {{ color.key }} is not?

© Stack Overflow or respective owner

Related posts about python

Related posts about google-app-engine