Ok, the results of an evening spent reading docs, searching for
answers, and otherwise beating my head against the GAE wall, is the
following:
If I pass the band name (band.band_name) on the URL, I am able to
search for it in the datastore with:
band_edit = Band.gql("WHERE band_name = 'id'")
And the page is rendered with just the band in question and not a
whole list of them. Well, that was easy. So, why don't I use it?
Because people can have several bands of the same name or misspell the
name or the like, and a unique ID as the entity ID would be much more
useful and accurate over time.
But if I try with the ID or Key, I have no luck. If I pass the ID as
band_id and then put it to the database as another string or integer
entity named band_id, and then try and search the datastore as above:
band_edit = Band.gql("WHERE band_id = 'id'")
I have no luck. None. (Yes, None with a big N). Either I get a
blank page or I am told that it can't iterate Band or there is an
integer or string error.
According to:
http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html#Queries_on_Keys
there are limited queries on Keys and IDs allowed.
I know that folks can do it, as I have seen GAE python based apps that
call individual entities by a URL id. Yes, the docs say you can, but
with no concrete examples. Is there a cookbook recipe for how to get
by ID or Key?
--
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.