Exemple #1
0
def history_for_object(request, app_label, module_name, object_id):
    check_permissions(request.user, [PERMISSION_HISTORY_VIEW])

    model = get_model(app_label, module_name)
    if not model:
        raise Http404
    content_object = get_object_or_404(model, pk=object_id)
    content_type = ContentType.objects.get_for_model(model)

    context = {
        'object_list':
        History.objects.filter(content_type=content_type, object_id=object_id),
        'title':
        _(u'history events for: %s') % content_object,
        'object':
        content_object,
        'extra_columns': [{
            'name': _(u'date and time'),
            'attribute': 'datetime'
        }, {
            'name':
            _(u'summary'),
            'attribute':
            encapsulate(lambda x: history_entry_summary(x))
        }],
        'hide_object':
        True,
    }

    return render_to_response('generic_list.html',
                              context,
                              context_instance=RequestContext(request))
Exemple #2
0
def history_for_object(request, app_label, module_name, object_id):
    check_permissions(request.user, [PERMISSION_HISTORY_VIEW])

    model = get_model(app_label, module_name)
    if not model:
        raise Http404
    content_object = get_object_or_404(model, pk=object_id)
    content_type = ContentType.objects.get_for_model(model)

    context = {
        'object_list': History.objects.filter(content_type=content_type, object_id=object_id),
        'title': _(u'history events for: %s') % content_object,
        'object': content_object,
        'extra_columns': [
            {
                'name': _(u'date and time'),
                'attribute': 'datetime'
            },
            {
                'name': _(u'summary'),
                'attribute': lambda x: history_entry_summary(x)
            }
        ],
        'hide_object': True,
    }

    return render_to_response('generic_list.html', context,
        context_instance=RequestContext(request))
Exemple #3
0
def history_list(request):
    check_permissions(request.user, [PERMISSION_HISTORY_VIEW])

    context = {
        'object_list':
        History.objects.all(),
        'title':
        _(u'history events'),
        'extra_columns': [{
            'name': _(u'date and time'),
            'attribute': 'datetime'
        }, {
            'name':
            _(u'object'),
            'attribute':
            encapsulate(lambda x: history_entry_object_link(x))
        }, {
            'name':
            _(u'summary'),
            'attribute':
            encapsulate(lambda x: history_entry_summary(x))
        }],
        'hide_object':
        True,
    }

    return render_to_response('generic_list.html',
                              context,
                              context_instance=RequestContext(request))
Exemple #4
0
def history_list(request):
    check_permissions(request.user, [PERMISSION_HISTORY_VIEW])

    context = {
        'object_list': History.objects.all(),
        'title': _(u'history events'),
        'extra_columns': [
            {
                'name': _(u'date and time'),
                'attribute': 'datetime'
            },
            {
                'name': _(u'object'),
                'attribute': lambda x: history_entry_object_link(x)
            },
            {
                'name': _(u'summary'),
                'attribute': lambda x: history_entry_summary(x)
            }
        ],
        'hide_object': True,
    }

    return render_to_response('generic_list.html', context,
        context_instance=RequestContext(request))