Google Groups Home
Help | Sign in
Cleaner, shorter "order_by" and "ordering" syntax
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Adrian Holovaty  
View profile  
 More options Jul 20 2005, 1:59 am
From: "Adrian Holovaty" <holov...@gmail.com>
Date: Wed, 20 Jul 2005 05:59:34 -0000
Local: Wed, Jul 20 2005 1:59 am
Subject: Cleaner, shorter "order_by" and "ordering" syntax
Instead of the following:

    ordering = (('pub_date', 'ASC'), ('name', 'DESC'), ('other',
'RANDOM'))

What do you think of this syntax?

    ordering = ('pub_date+', 'name-', 'other?')

This syntax would be used when declaring default ordering in models
(via the "ordering" argument), and it'd be used in the "order_by"
parameter to the database API.

I like it because it's a lot less crufty, easier to type and easier to
read.

The change can even be backwards-compatible if we wanted it to be,
although I'd want to phase out the old-style ordering eventually.

Thoughts?

Adrian


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matthew Marshall  
View profile  
 More options Jul 20 2005, 3:53 pm
From: Matthew Marshall <mmarsh...@myrealbox.com>
Date: Wed, 20 Jul 2005 19:53:32 +0000
Local: Wed, Jul 20 2005 3:53 pm
Subject: Re: Cleaner, shorter "order_by" and "ordering" syntax
I really like it.  It is much less error prone.

MWM

On Wednesday 20 July 2005 05:59 am, Adrian Holovaty wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
deelan  
View profile  
 More options Jul 21 2005, 10:33 am
From: "deelan" <dee...@gmail.com>
Date: Thu, 21 Jul 2005 14:33:53 -0000
Local: Thurs, Jul 21 2005 10:33 am
Subject: Re: Cleaner, shorter "order_by" and "ordering" syntax

Adrian Holovaty wrote:
> Instead of the following:

>     ordering = (('pub_date', 'ASC'), ('name', 'DESC'), ('other',
> 'RANDOM'))

> What do you think of this syntax?

>     ordering = ('pub_date+', 'name-', 'other?')
> The change can even be backwards-compatible if we wanted it to be,
> although I'd want to phase out the old-style ordering eventually.

> Thoughts?

similar to SQLObject, where IIRC you can declare a DESC order using
order_by='-pub_date'. you could imply a ASC order (that is without the
the + at the end).

go for it, adrian.

-- deelan.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pbx  
View profile  
 More options Jul 21 2005, 10:13 pm
From: "pbx" <paul.bis...@gmail.com>
Date: Fri, 22 Jul 2005 02:13:20 -0000
Local: Thurs, Jul 21 2005 10:13 pm
Subject: Re: Cleaner, shorter "order_by" and "ordering" syntax

Nice. Seems like it would make sense to follow the lead of SQLObject
here, prepending a "-" for descending order. It has the advantage of
making sense mathematically as well.

pb


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google