From d353537f392ab6f6f95072ea05d2803f88aefd6a Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sun, 25 Feb 2007 20:40:10 +0000 Subject: [PATCH] newforms-admin: Renamed ModelAdmin.change_list_queryset() to queryset(), and added queryset_add() and queryset_change() git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4584 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/options.py | 20 +++++++++++++++++++- django/contrib/admin/views/main.py | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 9323484203..b4c9d8f26b 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -271,9 +271,27 @@ class ModelAdmin(object): opts = self.opts return request.user.has_perm(opts.app_label + '.' + opts.get_delete_permission()) - def change_list_queryset(self, request): + def queryset(self, request): + """ + Returns a QuerySet of all model instances that can be edited by the + admin site. + """ return self.model._default_manager.get_query_set() + def queryset_add(self, request): + """ + Returns a QuerySet of all model instances that can be edited by the + admin site in the "add" stage. + """ + return self.queryset() + + def queryset_change(self, request): + """ + Returns a QuerySet of all model instances that can be edited by the + admin site in the "change" stage. + """ + return self.queryset() + def save_add(self, request, model, form, post_url_continue): """ Saves the object in the "add" stage and returns an HttpResponseRedirect. diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 55b1b15f5c..917d332ca4 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -229,7 +229,7 @@ class ChangeList(object): self.model = model self.opts = model._meta self.lookup_opts = self.opts - self.root_query_set = model_admin.change_list_queryset(request) + self.root_query_set = model_admin.queryset_change(request) self.list_display = list_display self.list_display_links = list_display_links self.list_filter = list_filter