Google Groups Home
Help | Sign in
#3400: [patch] Support for lookup separator with list_filter admin option
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
  12 messages - Collapse all
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
Django Code  
View profile
 More options Jan 30 2007, 12:59 am
From: "Django Code" <nore...@djangoproject.com>
Date: Tue, 30 Jan 2007 05:59:29 -0000
Local: Tues, Jan 30 2007 12:59 am
Subject: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
-----------------------------+--------------------------------------------- -
Reporter:  n...@intv.com.au  |       Owner:  adrian        
  Status:  new               |   Component:  Admin interface
 Version:  SVN               |    Keywords:                
   Stage:  Unreviewed        |   Has_patch:  1              
-----------------------------+--------------------------------------------- -
 This patch adds support for using the lookup separator in the list_filter
 option, for example:

 {{{
 class Town(models.Model):
     name = models.CharField()

 class House(models.Model):
     town = models.ForeignKey(Town)

 class Room(models.Model):
     house = models.ForeignKey(House)

 class Booking(models.Model):
     room = models.ForeignKey(Room, raw_id_admin=True)

     class Admin:
         list_filter = ('room__house__town',)
 }}}

 Will add a filter "For town:" that spans multiple foreign keys.

--
Ticket URL: <http://code.djangoproject.com/ticket/3400>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines


    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.
Django Code  
View profile
 More options Jan 30 2007, 3:43 am
From: "Django Code" <nore...@djangoproject.com>
Date: Tue, 30 Jan 2007 08:43:42 -0000
Local: Tues, Jan 30 2007 3:43 am
Subject: Re: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
--------------------------------+------------------------------------------ -
   Reporter:  n...@intv.com.au  |                Owner:  adrian                
     Status:  new               |            Component:  Admin interface      
    Version:  SVN               |           Resolution:                        
   Keywords:  list_filter       |                Stage:  Design decision needed
  Has_patch:  1                 |           Needs_docs:  0                    
Needs_tests:  0                 |   Needs_better_patch:  0                    
--------------------------------+------------------------------------------ -
Changes (by Simon G. <d...@simon.net.nz>):

  * keywords:  => list_filter
  * needs_better_patch:  => 0
  * stage:  Unreviewed => Design decision needed
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

--
Ticket URL: <http://code.djangoproject.com/ticket/3400#comment:1>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines


    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.
Django Code  
View profile
 More options Jan 31 2007, 1:29 am
From: "Django Code" <nore...@djangoproject.com>
Date: Wed, 31 Jan 2007 06:29:02 -0000
Local: Wed, Jan 31 2007 1:29 am
Subject: Re: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
--------------------------------+------------------------------------------ -
   Reporter:  n...@intv.com.au  |                Owner:  adrian                
     Status:  new               |            Component:  Admin interface      
    Version:  SVN               |           Resolution:                        
   Keywords:  list_filter       |                Stage:  Design decision needed
  Has_patch:  1                 |           Needs_docs:  0                    
Needs_tests:  0                 |   Needs_better_patch:  0                    
--------------------------------+------------------------------------------ -
Comment (by n...@intv.com.au):

 Hmm not sure how I didn't notice before, but this breaks the model
 validation in django.core.management:

 {{{
 for fn in opts.admin.list_display:
     try:
         f = opts.get_field(fn)
     except models.FieldDoesNotExist:
         if not hasattr(cls, fn):
             e.add(opts, '"admin.list_display" refers to %r, which isn\'t
 an attribute, method or property.' % fn)
     else:
         if isinstance(f, models.ManyToManyField):
             e.add(opts, '"admin.list_display" doesn\'t support
 ManyToManyFields (%r).' % fn)
 }}}

 Of course, it shouldn't be hard to fix - but is it worth it? This type of
 filtering is very useful for my particular apps but if it's not considered
 common enough for the core there's no point fixing the validation.

--
Ticket URL: <http://code.djangoproject.com/ticket/3400#comment:2>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines


    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.
Django Code  
View profile
 More options Feb 10 2007, 5:01 am
From: "Django Code" <nore...@djangoproject.com>
Date: Sat, 10 Feb 2007 10:01:57 -0000
Local: Sat, Feb 10 2007 5:01 am
Subject: Re: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
--------------------------------+------------------------------------------ -
   Reporter:  n...@intv.com.au  |                Owner:  adrian        
     Status:  new               |            Component:  Admin interface
    Version:  SVN               |           Resolution:                
   Keywords:  list_filter       |                Stage:  Accepted      
  Has_patch:  1                 |           Needs_docs:  0              
Needs_tests:  0                 |   Needs_better_patch:  1              
--------------------------------+------------------------------------------ -
Changes (by mtredinnick):

  * needs_better_patch:  0 => 1
  * stage:  Design decision needed => Accepted

Comment:

 I think it's worth getting this right. You probably aren't the only person
 wanting this functionality.

 A couple of comments on the patch:

   1. please create the diff from the top of the Django source tree. I had
 to guess a lot to work out that it was to be applied to
 {{{django/contrib/admin/views/main.py}}} (which I think is right). Having
 the full path from the tree root to the patched file is helpful.
   2. If the {{{FakeForeignKey}}} class has any visibility outside of that
 function (which I'm not sure about), it shouldn't be declared inside the
 function. In fact, I'm not really thrilled with declaring it inside the
 function in the first place, so probably best to move it out to the top-
 level of the file. I realise you are trying to avoid namespace pollution,
 but it's not worth the sacrifice of clarity to me.

--
Ticket URL: <http://code.djangoproject.com/ticket/3400#comment:3>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines


    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.
Django Code  
View profile
 More options Feb 13 2007, 6:50 pm
From: "Django Code" <nore...@djangoproject.com>
Date: Tue, 13 Feb 2007 23:50:34 -0000
Local: Tues, Feb 13 2007 6:50 pm
Subject: Re: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
--------------------------------+------------------------------------------ -
   Reporter:  n...@intv.com.au  |                Owner:  adrian        
     Status:  new               |            Component:  Admin interface
    Version:  SVN               |           Resolution:                
   Keywords:  list_filter       |                Stage:  Accepted      
  Has_patch:  1                 |           Needs_docs:  0              
Needs_tests:  0                 |   Needs_better_patch:  1              
--------------------------------+------------------------------------------ -
Changes (by nick.lane...@gmail.com):

 * cc: nick.lane...@gmail.com (added)

Comment:

 1. Oops, sorry about the diff - yes that's the correct file.
  2. {{{FakeForeignKey}}} is a wrapper around the {{{ForeignKey}}} field so
 that the {{{RelatedFilterSpec}}} will work across the foreign keys.
 Perhaps it could have a better name. It is only instantiated inside
 {{{get_filters()}}}, but {{{RelatedFilterSpec}}} will have access to it..
 so I'll move it to the top-level of the file like you have suggested.

 Will update the patch shortly when I have some time, Cheers.

--
Ticket URL: <http://code.djangoproject.com/ticket/3400#comment:4>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines


    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.
Django Code  
View profile
 More options Feb 18 2007, 8:33 am
From: "Django Code" <nore...@djangoproject.com>
Date: Sun, 18 Feb 2007 13:33:23 -0000
Local: Sun, Feb 18 2007 8:33 am
Subject: Re: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
--------------------------------+------------------------------------------ -
   Reporter:  n...@intv.com.au  |                Owner:  adrian        
     Status:  new               |            Component:  Admin interface
    Version:  SVN               |           Resolution:                
   Keywords:  list_filter       |                Stage:  Accepted      
  Has_patch:  1                 |           Needs_docs:  0              
Needs_tests:  0                 |   Needs_better_patch:  1              
--------------------------------+------------------------------------------ -
Comment (by Simon Litchfield <si...@slicmedia.com>):

 Works great thanks Nick. This was bugging me just the other day.

--
Ticket URL: <http://code.djangoproject.com/ticket/3400#comment:5>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines


    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.
Django Code  
View profile
 More options Mar 1 2007, 2:17 pm
From: "Django Code" <nore...@djangoproject.com>
Date: Thu, 01 Mar 2007 19:17:25 -0000
Local: Thurs, Mar 1 2007 2:17 pm
Subject: Re: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
--------------------------------+------------------------------------------ -
   Reporter:  n...@intv.com.au  |                Owner:  adrian        
     Status:  new               |            Component:  Admin interface
    Version:  SVN               |           Resolution:                
   Keywords:  list_filter       |                Stage:  Accepted      
  Has_patch:  1                 |           Needs_docs:  0              
Needs_tests:  0                 |   Needs_better_patch:  1              
--------------------------------+------------------------------------------ -
Comment (by cbr...@redback.com):

 This is exactly what I need.
 I'm going to apply this and try it out.

--
Ticket URL: <http://code.djangoproject.com/ticket/3400#comment:6>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines


    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.
Django Code  
View profile
 More options Oct 28 2007, 11:31 am
From: "Django Code" <nore...@djangoproject.com>
Date: Sun, 28 Oct 2007 15:31:50 -0000
Local: Sun, Oct 28 2007 11:31 am
Subject: Re: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
-----------------------------------------------------+--------------------- -
   Reporter:  n...@intv.com.au                       |                Owner:  nobody        
     Status:  new                                    |            Component:  Admin interface
    Version:  newforms-admin                         |           Resolution:                
   Keywords:  list_filter newforms-admin FilterSpec  |                Stage:  Accepted      
  Has_patch:  1                                      |           Needs_docs:  0              
Needs_tests:  0                                      |   Needs_better_patch:  1              
-----------------------------------------------------+--------------------- -
Changes (by Honza_Kral):

  * keywords:  list_filter => list_filter newforms-admin FilterSpec
  * version:  SVN => newforms-admin

Comment:

 I attached an alternative patch for newforms-admin branch... It can deal
 with {{{__}}} paths not just for {{{RelatedField}}}s but for any fields.
 It will traverse the path, return the last field in the chain and supply
 additional parameter {{{field_path}}} that is used for filtering the
 results.

 With this you can filter for example by a {{{DateField}}} stored on a
 related model.

--
Ticket URL: <http://code.djangoproject.com/ticket/3400#comment:7>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines


    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.
Django Code  
View profile
 More options Dec 1 2007, 12:25 pm
From: "Django Code" <nore...@djangoproject.com>
Date: Sat, 01 Dec 2007 17:25:22 -0000
Local: Sat, Dec 1 2007 12:25 pm
Subject: Re: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
-----------------------------------------------------+--------------------- -
   Reporter:  n...@intv.com.au                       |                Owner:  nobody        
     Status:  new                                    |            Component:  Admin interface
    Version:  newforms-admin                         |           Resolution:                
   Keywords:  list_filter newforms-admin FilterSpec  |                Stage:  Accepted      
  Has_patch:  1                                      |           Needs_docs:  0              
Needs_tests:  0                                      |   Needs_better_patch:  1              
-----------------------------------------------------+--------------------- -
Comment (by Honza_Kral):

 Also see #5833 for a way to enable users to register their own filter.

--
Ticket URL: <http://code.djangoproject.com/ticket/3400#comment:8>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines


    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.
Django Code  
View profile
 More options Mar 19, 12:57 am
From: "Django Code" <nore...@djangoproject.com>
Date: Wed, 19 Mar 2008 04:57:24 -0000
Local: Wed, Mar 19 2008 12:57 am
Subject: Re: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
-----------------------------------------------------------------+--------- -
   Reporter:  n...@intv.com.au                                   |                Owner:  nobody        
     Status:  new                                                |            Component:  Admin interface
    Version:  newforms-admin                                     |           Resolution:                
   Keywords:  nfa-someday list_filter FilterSpec nfa-changelist  |                Stage:  Accepted      
  Has_patch:  1                                                  |           Needs_docs:  0              
Needs_tests:  0                                                  |   Needs_better_patch:  1              
-----------------------------------------------------------------+--------- -
Changes (by ales_zoulek):

  * keywords:  nfa-someday list_filter FilterSpec => nfa-someday
               list_filter FilterSpec nfa-changelist

--
Ticket URL: <http://code.djangoproject.com/ticket/3400#comment:10>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines


    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.
Django Code  
View profile
 More options Jul 10, 6:42 am
From: "Django Code" <nore...@djangoproject.com>
Date: Thu, 10 Jul 2008 10:42:56 -0000
Local: Thurs, Jul 10 2008 6:42 am
Subject: Re: [Django Code] #3400: [patch] Support for lookup separator with list_filter admin option
#3400: [patch] Support for lookup separator with list_filter admin option
---------------------------------------+----------------------------------- -
          Reporter:  n...@intv.com.au  |         Owner:  nobody                                                  
&nbs