Пример #1
0
def object_add_source(id_: int) -> str:
    object_ = EntityMapper.get_by_id(id_)
    if request.method == 'POST':
        if request.form['checkbox_values']:
            object_.link('P128', request.form['checkbox_values'])
        return redirect(url_for('object_view', id_=id_) + '#tab-source')
    form = build_table_form('source', object_.get_linked_entities('P128'))
    return render_template('add_source.html', entity=object_, form=form)
Пример #2
0
def place_add_file(id_: int) -> str:
    object_ = EntityMapper.get_by_id(id_)
    if request.method == 'POST':
        if request.form['checkbox_values']:
            object_.link('P67', request.form['checkbox_values'], inverse=True)
        return redirect(url_for('place_view', id_=id_) + '#tab-file')
    form = build_table_form('file',
                            object_.get_linked_entities('P67', inverse=True))
    return render_template('add_file.html', entity=object_, form=form)
Пример #3
0
def actor_add_source(id_: int) -> str:
    actor = EntityMapper.get_by_id(id_)
    if request.method == 'POST':
        if request.form['checkbox_values']:
            actor.link('P67', request.form['checkbox_values'], inverse=True)
        return redirect(url_for('actor_view', id_=id_) + '#tab-source')
    form = build_table_form('source',
                            actor.get_linked_entities('P67', inverse=True))
    return render_template('add_source.html', entity=actor, form=form)
Пример #4
0
def file_add(id_: int, class_name: str) -> str:
    file = EntityMapper.get_by_id(id_)
    if request.method == 'POST':
        if request.form['checkbox_values']:
            file.link('P67', request.form['checkbox_values'])
        return redirect(
            url_for('file_view', id_=file.id) + '#tab-' + class_name)
    form = build_table_form(class_name, file.get_linked_entities('P67'))
    return render_template('file/add.html',
                           entity=file,
                           class_name=class_name,
                           form=form)