Пример #1
0
def item(_id):
    item = get_entity_or_404(_id, 'items')
    set_permissions(item)
    if is_json_request(flask.request):
        return flask.jsonify(item)
    if not item.get('_access'):
        return flask.render_template('wire_item_access_restricted.html',
                                     item=item)
    previous_versions = get_previous_versions(item)
    if 'print' in flask.request.args:
        template = 'wire_item_print.html'
        update_action_list([_id], 'prints', force_insert=True)
    else:
        template = 'wire_item.html'
    return flask.render_template(template,
                                 item=item,
                                 previous_versions=previous_versions)
Пример #2
0
def item(_id):
    item = get_entity_or_404(_id, 'items')
    set_permissions(item, 'media_releases')
    display_char_count = get_resource_service('ui_config').getSectionConfig('media_releases').get('char_count', False)
    if is_json_request(flask.request):
        return flask.jsonify(item)
    if not item.get('_access'):
        return flask.render_template('wire_item_access_restricted.html', item=item)
    previous_versions = get_previous_versions(item)
    if 'print' in flask.request.args:
        template = 'wire_item_print.html'
        update_action_list([_id], 'prints', force_insert=True)
    else:
        template = 'wire_item.html'
    return flask.render_template(
        template,
        item=item,
        previous_versions=previous_versions,
        display_char_count=display_char_count)