#1342 Allow customization of MAX_SHOW_ALL_ALLOWED. Reopen or new ticket?

40 views
Skip to first unread message

Jim D.

unread,
May 10, 2011, 3:09:05 PM5/10/11
to Django developers
I'm looking at a five-year-old ticket here (http://
code.djangoproject.com/ticket/1342) that suggests MAX_SHOW_ALL_ALLOWED
in the admin be configurable. As of now it is hard coded at 200 in
contrib/admin/views/main.py .

The ticket is, in my opinion, somewhat erroneously marked as "fixed",
as someone pointed out 14 months ago. The patch that supposedly fixed
it is the one that added the list_per_page attribute; however, that
patch only addressed half of the issue (ability to configure results
per page) and not the other half related to the show all.

Clearly this is not an issue of overwhelming importance or I'd imagine
it would have already come up in the last five years. Be that as it
may, I have an important use case where I'd like to preserve
pagination but allow for a show_all link to appear, which can only be
accomplished gracefully by changing the MAX_SHOW_ALL_ALLOWED. It also
strikes me as bad form to hard code an arbitrary value like that
without providing any recourse to amend it.

First question is administrative -- should I reopen this old ticket or
start a new ticket?

Second question is how to approach the patch. Is it acceptable to move
this to global_settings under an "Admin" section at the bottom and
leave it undocumented? Given that it's already undocumented and there
are other settings in global_settings that are also undocumented, this
would seem to be the quickest approach that would hopefully ruffle the
fewest feathers. If that's not kosher, I'd be happy to contribute a
patch with full documentation if need be, or to take a different
approach, e.g. make this configurable at the site or model admin
level.

Third question, is there some reason this issue has not been fixed
before or should not be fixed? Mostly I just want to make sure this
issue has not been discussed before and some conclusion reached that
I'm not aware of (searched, but couldn't find anything).

If anyone has any thoughts regarding any of these questions I'd
appreciate hearing them. My main objective is to find the most direct
path to something that you guys will find acceptable. Thanks.

Carl Meyer

unread,
May 10, 2011, 3:22:07 PM5/10/11
to django-d...@googlegroups.com
Hi Jim,

On 05/10/2011 02:09 PM, Jim D. wrote:
> I'm looking at a five-year-old ticket here (http://
> code.djangoproject.com/ticket/1342) that suggests MAX_SHOW_ALL_ALLOWED
> in the admin be configurable. As of now it is hard coded at 200 in
> contrib/admin/views/main.py .
>
> The ticket is, in my opinion, somewhat erroneously marked as "fixed",
> as someone pointed out 14 months ago. The patch that supposedly fixed
> it is the one that added the list_per_page attribute; however, that
> patch only addressed half of the issue (ability to configure results
> per page) and not the other half related to the show all.
>
> Clearly this is not an issue of overwhelming importance or I'd imagine
> it would have already come up in the last five years. Be that as it
> may, I have an important use case where I'd like to preserve
> pagination but allow for a show_all link to appear, which can only be
> accomplished gracefully by changing the MAX_SHOW_ALL_ALLOWED. It also
> strikes me as bad form to hard code an arbitrary value like that
> without providing any recourse to amend it.

Agreed.

> First question is administrative -- should I reopen this old ticket or
> start a new ticket?

I think I'd open a new one, in this case, with reference to the existing
one.

> Second question is how to approach the patch. Is it acceptable to move
> this to global_settings under an "Admin" section at the bottom and
> leave it undocumented? Given that it's already undocumented and there
> are other settings in global_settings that are also undocumented, this
> would seem to be the quickest approach that would hopefully ruffle the
> fewest feathers. If that's not kosher, I'd be happy to contribute a
> patch with full documentation if need be, or to take a different
> approach, e.g. make this configurable at the site or model admin
> level.

I think having it configurable at (ideally) both the admin-site and
model-admin level (and having that documented) would be much better than
a new setting.

> Third question, is there some reason this issue has not been fixed
> before or should not be fixed? Mostly I just want to make sure this
> issue has not been discussed before and some conclusion reached that
> I'm not aware of (searched, but couldn't find anything).

You've searched the mailing list and the ticket tracker - that's due
diligence. I haven't been around as long as some, but I don't know of
any discussions about this. I think it's just been low priority and
overlooked.

> If anyone has any thoughts regarding any of these questions I'd
> appreciate hearing them. My main objective is to find the most direct
> path to something that you guys will find acceptable. Thanks.

Thanks for contributing!

Carl

Mathieu AGOPIAN

unread,
May 12, 2011, 12:47:01 AM5/12/11
to django-d...@googlegroups.com
Just to make sure i've understood the topic here: you need to change MAX_SHOW_ALL_ALLOWED, but only for a specific model?

Otherwise you could just add something like that to, say, the root urlconf:

from django.contrib.admin.views import main as admin_views_main

admin_views_main.MAX_SHOW_ALL_ALLOWED = 1000

In the original ticket, there's no mention of this possibility, which I believe is a possible solution to (part of) the problem.

Sorry for the noise if I missed the point.

Mathieu

Jim D.

unread,
May 12, 2011, 9:56:01 AM5/12/11
to Django developers
On May 11, 9:47 pm, Mathieu AGOPIAN <mathieu.agop...@gmail.com> wrote:
> Just to make sure i've understood the topic here: you need to change
> MAX_SHOW_ALL_ALLOWED, but only for a specific model?
>
> Otherwise you could just add something like that to, say, the root urlconf:
>
> from django.contrib.admin.views import main as admin_views_main
>
> admin_views_main.MAX_SHOW_ALL_ALLOWED = 1000

Thanks Mathieu. That's actually a fine little hack for overriding the
default site-wide. If I'd thought of that in the first place I
probably wouldn't have gone through the trouble of bringing up this
issue. :)

As it were, I ended up opening a ticket submitting a patch that
converts it into an configurable attribute on ModelAdmin:
http://code.djangoproject.com/ticket/15997

The patch I attached there also adds some documentation and test
coverage for the show all feature, which is lacking at the moment, so
hopefully it represents an improvement on what we have now.
Reply all
Reply to author
Forward
0 new messages