mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
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
This commit is contained in:
parent
9c2f1ad89c
commit
d353537f39
@ -271,9 +271,27 @@ class ModelAdmin(object):
|
|||||||
opts = self.opts
|
opts = self.opts
|
||||||
return request.user.has_perm(opts.app_label + '.' + opts.get_delete_permission())
|
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()
|
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):
|
def save_add(self, request, model, form, post_url_continue):
|
||||||
"""
|
"""
|
||||||
Saves the object in the "add" stage and returns an HttpResponseRedirect.
|
Saves the object in the "add" stage and returns an HttpResponseRedirect.
|
||||||
|
@ -229,7 +229,7 @@ class ChangeList(object):
|
|||||||
self.model = model
|
self.model = model
|
||||||
self.opts = model._meta
|
self.opts = model._meta
|
||||||
self.lookup_opts = self.opts
|
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 = list_display
|
||||||
self.list_display_links = list_display_links
|
self.list_display_links = list_display_links
|
||||||
self.list_filter = list_filter
|
self.list_filter = list_filter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user