Permalink
Browse files

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
  • Loading branch information...
1 parent 9c2f1ad commit d353537f392ab6f6f95072ea05d2803f88aefd6a @adrianholovaty adrianholovaty committed Feb 25, 2007
Showing with 20 additions and 2 deletions.
  1. +19 −1 django/contrib/admin/options.py
  2. +1 −1 django/contrib/admin/views/main.py
@@ -271,9 +271,27 @@ def has_delete_permission(self, request, obj):
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.
@@ -229,7 +229,7 @@ def __init__(self, request, model, list_display, list_display_links, list_filter
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

0 comments on commit d353537

Please sign in to comment.