newbie doubt: model.key() issue in template

1 view
Skip to first unread message

Vijayakumar Subburaj

unread,
Aug 24, 2008, 8:14:05 AM8/24/08
to Google App Engine
I couldn't use {{model.key()}} from a template when passed through
template_value. Is there any other ways to get key from template?

{{model.key}} works from template, but it seems a junk value.

error,

TemplateSyntaxError: Could not parse the remainder: ()
Message has been deleted
Message has been deleted

Vijayakumar Subburaj

unread,
Aug 24, 2008, 8:38:57 AM8/24/08
to Google App Engine


On Aug 24, 5:17 pm, Davide Rognoni <davide.rogn...@gmail.com> wrote:
> On Aug 24, 2:14 pm, v4vijayakumar <vijayakumar.subbu...@gmail.com>
> right {{site.key}}

thanks for your quick response.

But, {{model.key}} is not the key I used to store the data. key, I
used is something like this,

test.get_or_insert('key_' + user.email(), user=user)

so, {{model.key}} seems wrong. It should be like,
'key_...@example.com'.
Message has been deleted

Vijayakumar Subburaj

unread,
Aug 24, 2008, 8:53:05 AM8/24/08
to Google App Engine


On Aug 24, 5:46 pm, Davide Rognoni <davide.rogn...@gmail.com> wrote:
> > so, {{model.key}} seems wrong. It should be like,
> > 'key_t...@example.com'.
>
> Show me the key rendered in HTML page.
> (now in your browser, view source and post here)

..
<input name="cb_ip1" type="checkbox"
value="agVqdWwyMXIZCxILVXNlcnNPbmxpbmUiCGtleV90ZXN0DA" disabled>test</
input>
..
<input name="cb_ip2" type="checkbox"
value="agVqdWwyMXIaCxILVXNlcnNPbmxpbmUiCWtleV90ZXN0Mgw"
disabled>test2</input>
..
Message has been deleted

Vijayakumar Subburaj

unread,
Aug 24, 2008, 9:38:23 AM8/24/08
to Google App Engine


On Aug 24, 6:01 pm, Davide Rognoni <davide.rogn...@gmail.com> wrote:
> On Aug 24, 2:53 pm, v4vijayakumar <vijayakumar.subbu...@gmail.com>
> Use key_name
>
> because this is the key
> "agVqdWwyMXIZCxILVXNlcnNPbmxpbmUiCGtleV90ZXN0DA"
>

sorry. this too is not working.

key_name is empty.

<input name="cb_ip2" type="checkbox" value="" disabled>test2</input>
Message has been deleted

Vijayakumar Subburaj

unread,
Aug 24, 2008, 10:03:08 AM8/24/08
to Google App Engine


On Aug 24, 6:43 pm, Davide Rognoni <davide.rogn...@gmail.com> wrote:
> Can you send me your test project (a ZIP file) by email?

Project is not a secret but a suspense. ;)

I figured out. Now it is working.

I wrapped these data inside other class, like this,

class TestItem:
a = ''
def __init__(self, k):
a = k

...
test_list = []
test_list.append(TestItem(model.key().name()))
...

now, I can access {{model.a}} from template.

djidjadji BG

unread,
Aug 24, 2008, 10:31:00 AM8/24/08
to google-a...@googlegroups.com
Hi,

just use this in your template

{{ model.key.name }}

It calls the methods.

2008/8/24 v4vijayakumar <vijayakuma...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages