Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Simplifying id__exact lookups
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
  6 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
 
Jacob Kaplan-Moss  
View profile  
 More options Jul 22 2005, 5:18 pm
From: Jacob Kaplan-Moss <ja...@jacobian.org>
Date: Fri, 22 Jul 2005 16:18:48 -0500
Local: Fri, Jul 22 2005 5:18 pm
Subject: Simplifying id__exact lookups
Howdy folks --

We had quite the lively talk on IRC this afternoon about the  
verbosity of "id__exact" lookups.  A few people mentioned that it's  
pretty annoying to have to type a comparatively long string for the  
most common lookup type.

We talked about a few other options -- you can see the whole  
discussion at http://loglibrary.com/show_page/view/179?
Multiplier=3600&Interval=6&StartTime=1122065878 -- but in the end  
came up with a fairly simple proposal:

Let "mod.get_object(pk=something)" be the same as "mod.get_object
(id__exact=something)" -- where "id" would obviously get replaced by  
the actual name of the primary key (should it be different).

What about it?

Jacob


    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.
Jeremy Dunck  
View profile  
 More options Jul 22 2005, 5:44 pm
From: Jeremy Dunck <jdu...@gmail.com>
Date: Fri, 22 Jul 2005 16:44:45 -0500
Local: Fri, Jul 22 2005 5:44 pm
Subject: Re: Simplifying id__exact lookups
On 7/22/05, Jacob Kaplan-Moss <ja...@jacobian.org> wrote:

> Let "mod.get_object(pk=something)" be the same as "mod.get_object
> (id__exact=something)" -- where "id" would obviously get replaced by
> the actual name of the primary key (should it be different).

And anyone that has a column named "id" which is not actually the PK
deserves the pain they'll feel.  ;-)

    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.
Robin Munn  
View profile  
 More options Jul 22 2005, 5:50 pm
From: Robin Munn <robin.m...@gmail.com>
Date: Fri, 22 Jul 2005 16:50:22 -0500
Local: Fri, Jul 22 2005 5:50 pm
Subject: Re: Simplifying id__exact lookups
On 7/22/05, Jacob Kaplan-Moss <ja...@jacobian.org> wrote:

> Let "mod.get_object(pk=something)" be the same as "mod.get_object
> (id__exact=something)" -- where "id" would obviously get replaced by
> the actual name of the primary key (should it be different).

> What about it?

Since I came up with the idea, I'm obviously +1. :-)

Seriously, though, this would solve most of the annoyance I feel at
having to type "id__exact" all the time. Plus it has the added bonus
of being much shorter to type if your primary key is named
CustomerSocialSecurityNumber. :-) It doesn't solve every case where a
shorthand for "field__exact" might be desired, but most often when
you're looking up on a non-pk field, you're expecting multiple
results, so you probably *want* that explicit __exact in there.

--
Robin Munn
Robin.M...@gmail.com
GPG key 0xD6497014


    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.
Ian Bicking  
View profile  
 More options Jul 22 2005, 7:55 pm
From: Ian Bicking <i...@colorstudy.com>
Date: Fri, 22 Jul 2005 18:55:18 -0500
Local: Fri, Jul 22 2005 7:55 pm
Subject: Re: Simplifying id__exact lookups

Jacob Kaplan-Moss wrote:
> Let "mod.get_object(pk=something)" be the same as "mod.get_object
> (id__exact=something)" -- where "id" would obviously get replaced by  
> the actual name of the primary key (should it be different).

Why not mod.get_object(something)?

--
Ian Bicking  /  i...@colorstudy.com  / http://blog.ianbicking.org


    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.
Robin Munn  
View profile  
 More options Jul 22 2005, 11:35 pm
From: Robin Munn <robin.m...@gmail.com>
Date: Fri, 22 Jul 2005 22:35:07 -0500
Local: Fri, Jul 22 2005 11:35 pm
Subject: Re: Simplifying id__exact lookups
On 7/22/05, Ian Bicking <i...@colorstudy.com> wrote:

> Jacob Kaplan-Moss wrote:
> > Let "mod.get_object(pk=something)" be the same as "mod.get_object
> > (id__exact=something)" -- where "id" would obviously get replaced by
> > the actual name of the primary key (should it be different).

> Why not mod.get_object(something)?

Everything else is handled by kwargs in the _parse_lookup() function;
I don't think primary-key lookups are special enough to break the
rules. Not when typing just three characters extra lets you stay
within the existing pattern.

BTW, this feature, once implemented, should allow us to close
http://code.djangoproject.com/ticket/168.

--
Robin Munn
Robin.M...@gmail.com
GPG key 0xD6497014


    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.
Robin Munn  
View profile  
 More options Jul 23 2005, 12:09 am
From: Robin Munn <robin.m...@gmail.com>
Date: Fri, 22 Jul 2005 23:09:31 -0500
Local: Sat, Jul 23 2005 12:09 am
Subject: Re: Simplifying id__exact lookups
I've written a patch for the pk=(value) syntax and placed it on
http://code.djangoproject.com/ticket/163.

--
Robin Munn
Robin.M...@gmail.com
GPG key 0xD6497014


    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