Ticket #7510: modeladmin_override_manager.diff
File modeladmin_override_manager.diff, 1.8 KB (added by , 16 years ago) |
---|
-
django/contrib/admin/options.py
319 319 opts = self.opts 320 320 return request.user.has_perm(opts.app_label + '.' + opts.get_delete_permission()) 321 321 322 def manager(self, request): 323 """ 324 Returns a Manager to be queried in the admin site. This is used by 325 queryset, changelist_view, and delete_view. 326 """ 327 return self.model._default_manager 328 322 329 def queryset(self, request): 323 330 """ 324 331 Returns a QuerySet of all model instances that can be edited by the 325 332 admin site. This is used by changelist_view. 326 333 """ 327 qs = self.m odel._default_manager.get_query_set()334 qs = self.manager(request).get_query_set() 328 335 # TODO: this should be handled by some parameter to the ChangeList. 329 336 ordering = self.ordering or () # otherwise we might try to *None, which is bad ;) 330 337 if ordering: … … 550 557 app_label = opts.app_label 551 558 552 559 try: 553 obj = model._default_manager.get(pk=object_id)560 obj = self.manager(request).get(pk=object_id) 554 561 except model.DoesNotExist: 555 562 # Don't raise Http404 just yet, because we haven't checked 556 563 # permissions yet. We don't want an unauthenticated user to be able … … 662 669 app_label = opts.app_label 663 670 664 671 try: 665 obj = self.m odel._default_manager.get(pk=object_id)672 obj = self.manager(request).get(pk=object_id) 666 673 except self.model.DoesNotExist: 667 674 # Don't raise Http404 just yet, because we haven't checked 668 675 # permissions yet. We don't want an unauthenticated user to be able