views:

35

answers:

2

I have a feeling the answer is simple and documented, but I'm absolutely missing it:

Is there a way, using Python and webapp through Google App Engine, to pass the id field of a record to the template? I'm fairly new to the app engine, and yes, I have searched all around the Google Documentation to find this.

+3  A: 

I can reference it through record.key().id(). I just found this RIGHT AFTER I posted this question (as luck would have it). Sorry for wasting anybody's time.

Matt
Oh wow... Didn't didn't see your answer while submitting mine... Deleting
Gab Royer
Note that these IDs are unique across all kinds, so for any given kind, the entities' IDs may not be a natural progression (`1, 2, 3, ...`). Some numbers will be missing because they'll have been assigned to entities of other kinds.
Nikhil Chelliah
Nikhil: that's not correct. IDs aren't even unique within a kind; they're unique within a kind and entity group. The reason they're not sequential is that an instance is allocated a large block of IDs, and unused ones aren't assigned to later instances.
Wooble
+1  A: 

Assuming you're using the built-in Django 0.96 templates, you can access the ID (assuming the entity has one; it might have a key name instead if you saved it with one) with {{entity.key.id}}.

Wooble