Ticket #16465: admin-history_view.patch
File admin-history_view.patch, 1.1 KB (added by , 13 years ago) |
---|
-
django/contrib/admin/options.py
old new 1242 1242 def history_view(self, request, object_id, extra_context=None): 1243 1243 "The 'history' admin view for this model." 1244 1244 from django.contrib.admin.models import LogEntry 1245 import inspect 1245 1246 model = self.model 1246 1247 opts = model._meta 1247 1248 app_label = opts.app_label 1249 ct_set = set() 1250 for m in inspect.getmro(model): 1251 try: 1252 ct = ContentType.objects.get_for_model(m) 1253 ct_set.add(ct.id) 1254 except: 1255 pass 1248 1256 action_list = LogEntry.objects.filter( 1249 1257 object_id = object_id, 1250 content_type__id__ exact = ContentType.objects.get_for_model(model).id1258 content_type__id__in = ct_set 1251 1259 ).select_related().order_by('action_time') 1252 1260 # If no history was found, see whether this object even exists. 1253 1261 obj = get_object_or_404(model, pk=unquote(object_id))