As Nick pointed out you can make a key from an id: Key.from_path('User',
id).

2009/5/1 Dave <ddev...@gmail.com>

>
> Thx Alkis, I'm familiar with this format but really trying to retain
> use of get_list_or_404() functionality. Also are you saying this would
> work for numeric ID? What i've got is ID from .key().id() not an
> actual User object or .key(). I'm specifically trying not to use Key
> ().
>
>
>
> On May 1, 9:28 am, Alkis Evlogimenos ('Αλκης Ευλογημένος)
> <evlogime...@gmail.com> wrote:
> > What you want to do is:
> >
> > albums = Album.all().filter('user =', aUser).fetch(1000)
> >
> > aUser can be a key to a user or a user entity.
> >
> >
> >
> > On Fri, May 1, 2009 at 3:19 PM, Dave <ddev...@gmail.com> wrote:
> >
> > > Wow, thx for the super fast respone Nick. You're the best.
> >
> > > So I am probably still confused. I tried the following:
> >
> > > queryset = get_list_or_404(Album, 'user =',db.Key.from_path
> > > ('User',key))
> > > where key = 2. I get "Names may not begin with a digit; received %s.'
> > > % id_or_name)"
> >
> > > This leads be to beleive it's trying to pull a key_name vs. an ID.
> >
> > > I'm not sure how to use the get_by_id since I'm looking to filter by a
> > > reference property of User within the Album model that points to User.
> > > It seems Album.get_by_id would return a single album record. I'm
> > > looking to get all Albums for a specific user.
> >
> > > thx,
> >
> > > On May 1, 9:03 am, "Nick Johnson (Google)" <nick.john...@google.com>
> > > wrote:
> > > > Hi Dave,
> >
> > > > You have two options here: Construct a Key object from the ID and
> kind,
> > > like so:
> >
> > > > db.Key.from_path('Album', id)
> >
> > > > or you can use the convenience method get_by_id on a Model class:
> >
> > > > Album.get_by_id(id).
> >
> > > > -Nick Johnson
> >
> > --
> >
> > Alkis
> >
>


-- 

Alkis

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

Reply via email to