Alex,
  You can only order by properties on the model itself.  If you want
to order by a property on a referenced model, you need to include it.
So in your case you might want to add a "reelName" property to Frame,
then just be sure you handle updating that property when you change
the name on Reel.

Robert







On Wed, Feb 24, 2010 at 9:09 AM, Alex <alexle...@googlemail.com> wrote:
> Hi,
> Is it possible to do anything with a reference property other than
> cycle through the referenced objects in whatever order they are
> returned? For example I have a number of reference properties to
> instances where the creation date is crucial to how they are
> subsequently managed. Is there a way to order the result?
>
> class Reel(db.Model):
>   name = db.StringProperty()
>
> class Frame(db.Model):
>    # datetime.datetime.now() when the object is first created.
>    auto_now_add_prop = db.DateTimeProperty(auto_now_add=True)
>    # reference to the one and only reel this frame belong to
>    reel = db.ReferenceProperty(Reel, collection_name='frames')
>
> I would like to order 'reel.frames' depending on the
> 'auto_now_add_prop' date. Is this the right way to access these
> instances if date order access is frequent and  crucial?
> The Frame model will have millions of instances so a query there
> matching for a given Reel instance would be expensive. Ideas/advice/a
> thread I haven't seen?
>
> Alex
>
> --
> 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-appeng...@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.
>
>

-- 
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-appeng...@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