Ticket #16465: admin-history_view.patch

File admin-history_view.patch, 1.1 KB (added by Gertjan van Oosten, 13 years ago)
  • django/contrib/admin/options.py

    old new  
    12421242    def history_view(self, request, object_id, extra_context=None):
    12431243        "The 'history' admin view for this model."
    12441244        from django.contrib.admin.models import LogEntry
     1245        import inspect
    12451246        model = self.model
    12461247        opts = model._meta
    12471248        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
    12481256        action_list = LogEntry.objects.filter(
    12491257            object_id = object_id,
    1250             content_type__id__exact = ContentType.objects.get_for_model(model).id
     1258            content_type__id__in = ct_set
    12511259        ).select_related().order_by('action_time')
    12521260        # If no history was found, see whether this object even exists.
    12531261        obj = get_object_or_404(model, pk=unquote(object_id))
Back to Top