Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix for #1089: Allow overrides of delete_confirmation and object_hist…

…ory,

patch supplied by Joseph Kocherhans.


git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2416 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e9e18209cd1103ed119336d92f951d3dd170ad2e 1 parent 1638755
authored February 27, 2006

Showing 1 changed file with 10 additions and 4 deletions. Show diff stats Hide diff stats

  1. 14  django/contrib/admin/views/main.py
14  django/contrib/admin/views/main.py
@@ -456,13 +456,16 @@ def delete_stage(request, app_label, model_name, object_id):
456 456
         LogEntry.objects.log_action(request.user.id, ContentType.objects.get_for_model(model).id, object_id, obj_display, DELETION)
457 457
         request.user.message_set.add(message=_('The %(name)s "%(obj)s" was deleted successfully.') % {'name': opts.verbose_name, 'obj': obj_display})
458 458
         return HttpResponseRedirect("../../")
459  
-    return render_to_response('admin/delete_confirmation', {
  459
+    extra_context = {
460 460
         "title": _("Are you sure?"),
461 461
         "object_name": opts.verbose_name,
462 462
         "object": obj,
463 463
         "deleted_objects": deleted_objects,
464 464
         "perms_lacking": perms_needed,
465  
-    }, context_instance=template.RequestContext(request))
  465
+    }
  466
+    return render_to_response(["admin/%s/%s/delete_confirmation" % (app_label, opts.object_name.lower() ),
  467
+                               "admin/%s/delete_confirmation" % app_label ,
  468
+                               "admin/delete_confirmation"], extra_context, context_instance=Context(request)) 
466 469
 delete_stage = staff_member_required(delete_stage)
467 470
 
468 471
 def history(request, app_label, model_name, object_id):
@@ -473,12 +476,15 @@ def history(request, app_label, model_name, object_id):
473 476
         content_type__id__exact=ContentType.objects.get_for_model(model).id).select_related().order_by('action_time')
474 477
     # If no history was found, see whether this object even exists.
475 478
     obj = get_object_or_404(model, pk=object_id)
476  
-    return render_to_response('admin/object_history', {
  479
+    extra_context = {
477 480
         'title': _('Change history: %s') % obj,
478 481
         'action_list': action_list,
479 482
         'module_name': capfirst(model._meta.verbose_name_plural),
480 483
         'object': obj,
481  
-    }, context_instance=template.RequestContext(request))
  484
+    }
  485
+    return render_to_response(["admin/%s/%s/object_history" % (app_label, opts.object_name.lower() ),
  486
+                               "admin/%s/object_history" % app_label ,
  487
+                               "admin/object_history"], extra_context, context_instance=Context(request)) 
482 488
 history = staff_member_required(history)
483 489
 
484 490
 class ChangeList(object):

0 notes on commit e9e1820

Please sign in to comment.
Something went wrong with that request. Please try again.