mirror of https://github.com/django/django.git
parent
cb47969cd7
commit
274048351a
|
@ -784,8 +784,7 @@ class ModelAdmin(BaseModelAdmin):
|
||||||
"""
|
"""
|
||||||
# If self.actions is explicitly set to None that means that we don't
|
# If self.actions is explicitly set to None that means that we don't
|
||||||
# want *any* actions enabled on this page.
|
# want *any* actions enabled on this page.
|
||||||
from django.contrib.admin.views.main import _is_changelist_popup
|
if self.actions is None or IS_POPUP_VAR in request.GET:
|
||||||
if self.actions is None or _is_changelist_popup(request):
|
|
||||||
return OrderedDict()
|
return OrderedDict()
|
||||||
|
|
||||||
actions = []
|
actions = []
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
|
|
||||||
from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured
|
from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured
|
||||||
from django.core.paginator import InvalidPage
|
from django.core.paginator import InvalidPage
|
||||||
|
@ -8,7 +7,6 @@ from django.core.urlresolvers import reverse
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.fields import FieldDoesNotExist
|
from django.db.models.fields import FieldDoesNotExist
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.deprecation import RemovedInDjango18Warning
|
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
from django.utils.translation import ugettext, ugettext_lazy
|
from django.utils.translation import ugettext, ugettext_lazy
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
|
@ -34,29 +32,6 @@ IGNORED_PARAMS = (
|
||||||
EMPTY_CHANGELIST_VALUE = ugettext_lazy('(None)')
|
EMPTY_CHANGELIST_VALUE = ugettext_lazy('(None)')
|
||||||
|
|
||||||
|
|
||||||
def _is_changelist_popup(request):
|
|
||||||
"""
|
|
||||||
Returns True if the popup GET parameter is set.
|
|
||||||
|
|
||||||
This function is introduced to facilitate deprecating the legacy
|
|
||||||
value for IS_POPUP_VAR and should be removed at the end of the
|
|
||||||
deprecation cycle.
|
|
||||||
"""
|
|
||||||
|
|
||||||
if IS_POPUP_VAR in request.GET:
|
|
||||||
return True
|
|
||||||
|
|
||||||
IS_LEGACY_POPUP_VAR = 'pop'
|
|
||||||
if IS_LEGACY_POPUP_VAR in request.GET:
|
|
||||||
warnings.warn(
|
|
||||||
"The `%s` GET parameter has been renamed to `%s`." %
|
|
||||||
(IS_LEGACY_POPUP_VAR, IS_POPUP_VAR),
|
|
||||||
RemovedInDjango18Warning, 2)
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
class ChangeList(object):
|
class ChangeList(object):
|
||||||
def __init__(self, request, model, list_display, list_display_links,
|
def __init__(self, request, model, list_display, list_display_links,
|
||||||
list_filter, date_hierarchy, search_fields, list_select_related,
|
list_filter, date_hierarchy, search_fields, list_select_related,
|
||||||
|
@ -82,7 +57,7 @@ class ChangeList(object):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.page_num = 0
|
self.page_num = 0
|
||||||
self.show_all = ALL_VAR in request.GET
|
self.show_all = ALL_VAR in request.GET
|
||||||
self.is_popup = _is_changelist_popup(request)
|
self.is_popup = IS_POPUP_VAR in request.GET
|
||||||
self.to_field = request.GET.get(TO_FIELD_VAR)
|
self.to_field = request.GET.get(TO_FIELD_VAR)
|
||||||
self.params = dict(request.GET.items())
|
self.params = dict(request.GET.items())
|
||||||
if PAGE_VAR in self.params:
|
if PAGE_VAR in self.params:
|
||||||
|
|
Loading…
Reference in New Issue