Ticket #7510: use_queryset_in_delete_view_and_change_view_for_ModelAdmin.diff

File use_queryset_in_delete_view_and_change_view_for_ModelAdmin.diff, 1.6 KB (added by tom, 16 years ago)
  • django/contrib/admin/options.py

     
    550550        app_label = opts.app_label
    551551
    552552        try:
    553             obj = model._default_manager.get(pk=object_id)
     553            obj = self.queryset(request).get(pk=object_id)
    554554        except model.DoesNotExist:
    555555            # Don't raise Http404 just yet, because we haven't checked
    556556            # permissions yet. We don't want an unauthenticated user to be able
     
    662662        app_label = opts.app_label
    663663
    664664        try:
    665             obj = self.model._default_manager.get(pk=object_id)
     665            obj = self.queryset(request).get(pk=object_id)
    666666        except self.model.DoesNotExist:
    667667            # Don't raise Http404 just yet, because we haven't checked
    668668            # permissions yet. We don't want an unauthenticated user to be able
     
    719719            content_type__id__exact = ContentType.objects.get_for_model(model).id
    720720        ).select_related().order_by('action_time')
    721721        # If no history was found, see whether this object even exists.
    722         obj = get_object_or_404(model, pk=object_id)
     722        try:
     723            obj = self.queryset(request).get(pk=object_id)
     724        except model.DoesNotExist:
     725            raise Http404('No %s matches the given query.' % model._meta.object_name)
    723726        context = {
    724727            'title': _('Change history: %s') % force_unicode(obj),
    725728            'action_list': action_list,
Back to Top