created_at = db.DateTimeProperty(auto_now_add=True)

    updated_at = db.DateTimeProperty(auto_now=True)


I almost add that to any datastore model i got so i could always use order
by created_at desc.

Please remember that in some cases you need an index for that to use online.

Default for datastore is ascending.


-
Cheers,

def AlonCarmel(request)
     import simplejson as json
     contact = {}
     contant['email'] = '[email protected]'
     contact['twitter'] = '@aloncarmel'
     contact['web'] = 'http://aloncarmel.me'
     contact['phone'] = '+972-54-4860380'
     return HttpResponse(json.dumps(contact))



* If you received an unsolicited email from by mistake that wasn't of your
matter please delete immediately. All E-mail sent from Alon Carmel is
copyrighted to Alon Carmel 2008. Any details revealed in e-mails sent by
Alon Carmel are owned by the Author only. Any attempt to duplicate or
imitate any of the Content is prohibited under copyright law 2008.



On Fri, Jul 16, 2010 at 7:56 PM, Geoffrey Spear <[email protected]>wrote:

> If you want to get your data in the order it was inserted, it's almost
> certainly easier to use a DatetimeProperty with auto_now_add = True
> than to try to maintain your own guaranteed sequential IDs.
>
> On Jul 16, 12:07 pm, Blixt <[email protected]> wrote:
> > Okay, so data will be returned in a non-determinate order unless you
> > specify keys yourself (since ids aren't guaranteed to be in order).
> > I'll make my own counter.
> >
> > Thanks!
> >
> > On Jul 16, 6:01 pm, Nate Bauernfeind <[email protected]>
> > wrote:
> >
> > > They will be ordered by key. You should consider watching one of the
> > > datastore tech talks.
> >
> > > On Fri, Jul 16, 2010 at 3:54 AM, Blixt <[email protected]> wrote:
> > > > Imagine this query:
> >
> > > > Person.all().fetch(100)
> >
> > > > Is the order of data in the datastore guaranteed, or can the order of
> > > > the entities returned change as data is inserted?
> >
> > > > --
> > > > 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]<google-appengine%[email protected]><google-appengine%2Bunsubscrib
> [email protected]>
> > > > .
> > > > 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> 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 [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.

Reply via email to