Exemplo n.º 1
0
def entity_view(request, entity_id):
    entity = get_object_or_404(Entity, id=entity_id)
    incomplete = entity.check_complete()
    if incomplete:
        storage = messages.get_messages(request)
        for message in storage: pass
        storage.used = True
        msg = _('Entity metadata still incomplete. Please fill in the '
                'missing data before submitting for review')
        messages.warning(request, msg)
    elif entity.state == entity.STATE.COM:
        entity.modify(etree.tostring(entity._load_metadata().etree))
        msg = _('Entity metadata complete. You can now '
                '<a href="{!s}">submit for review</a>').format(
                        reverse('entities:edit_metadata', args=(entity_id,)))
        messages.success(request, msg, extra_tags='safe')
    elif entity.state != entity.STATE.PUB:
        entity.modify(etree.tostring(entity._load_metadata().etree))
        msg = _('Entity metadata complete. Your entity is now '
                'pending review')
        messages.success(request, msg)
    if entity.has_metadata():
        try:
            revs = add_previous_revisions(entity.metadata.list_revisions())
        except ValueError:
            # New entity with no commited metadata, so revisions are empty
            revs = []
    else:
        revs = []

    return render_to_response('entity/view.html', {
        'entity': entity,
        'revs': revs,
        'incomplete': incomplete,
    }, context_instance=RequestContext(request))
Exemplo n.º 2
0
def entity_view(request, entity_id):
    entity = get_object_or_404(Entity, id=entity_id)
    if entity.has_metadata():
        revs = add_previous_revisions(entity.metadata.list_revisions())
    else:
        revs = []

    return render_to_response('entity/view.html', {
            'entity': entity,
            'revs': revs,
            }, context_instance=RequestContext(request))
Exemplo n.º 3
0
def entity_view(request, entity_id):
    entity = get_object_or_404(Entity, id=entity_id)
    if entity.has_metadata():
        try:
            revs = add_previous_revisions(entity.metadata.list_revisions())
        except ValueError:
            # New entity with no commited metadata, so revisions are empty
            revs = []
    else:
        revs = []

    return render_to_response('entity/view.html', {
        'entity': entity,
        'revs': revs,
    }, context_instance=RequestContext(request))
Exemplo n.º 4
0
def entity_view(request, entity_id):
    entity = get_object_or_404(Entity, id=entity_id)
    incomplete = entity.check_complete()
    if incomplete:
        storage = messages.get_messages(request)
        for message in storage:
            pass
        storage.used = True
        msg = _('Entity metadata still incomplete. Please fill in the '
                'missing data before submitting for review')
        messages.warning(request, msg)
    elif entity.state == entity.STATE.COM:
        entity.modify(etree.tostring(entity._load_metadata().etree))
        msg = _('Entity metadata complete. You can now '
                '<a href="{!s}">submit for review</a>').format(
                    reverse('entities:edit_metadata', args=(entity_id, )))
        messages.success(request, msg, extra_tags='safe')
    elif entity.state != entity.STATE.PUB:
        entity.modify(etree.tostring(entity._load_metadata().etree))
        msg = _('Entity metadata complete. Your entity is now '
                'pending review')
        messages.success(request, msg)
    if entity.has_metadata():
        try:
            revs = add_previous_revisions(entity.metadata.list_revisions())
        except ValueError:
            # New entity with no commited metadata, so revisions are empty
            revs = []
    else:
        revs = []

    return render_to_response('entity/view.html', {
        'entity': entity,
        'revs': revs,
        'incomplete': incomplete,
    },
                              context_instance=RequestContext(request))
Exemplo n.º 5
0
 def items(self, entity):
     revs = add_previous_revisions(entity.metadata.list_revisions())
     return [{'entity': entity, 'revision': rev} for rev in revs]
Exemplo n.º 6
0
 def items(self, entity):
     revs = add_previous_revisions(entity.metadata.list_revisions())
     return [{'entity': entity, 'revision': rev} for rev in revs]