continue additional metadata

This commit is contained in:
Stephan Porada 2020-01-10 11:29:26 +01:00
parent 4d17bacfb7
commit cee89dd712
3 changed files with 10 additions and 13 deletions

View File

@ -106,7 +106,10 @@ def add_corpus_file(corpus_id):
or field.id == "csrf_token"
or field.id == "file")]
field_dict = dict(zip(ids, data))
corpus_file = CorpusFile(**field_dict, corpus=corpus, dir=dir, filename=filename)
corpus_file = CorpusFile(**field_dict,
corpus=corpus,
dir=dir,
filename=filename)
db.session.add(corpus_file)
db.session.commit()
thread = Thread(target=edit_corpus_file_,
@ -165,8 +168,6 @@ def edit_corpus_file(corpus_id, corpus_file_id):
if edit_corpus_file_form.validate_on_submit():
corpus_file.author = edit_corpus_file_form.author.data
corpus_file.publishing_year = edit_corpus_file_form.publishing_year.data
corpus_file.title = edit_corpus_file_form.title.data
corpus_file.pages = edit_corpus_file_form.pages.data
db.session.commit()
thread = Thread(target=edit_corpus_file_,
args=(current_app._get_current_object(),

View File

@ -2,7 +2,7 @@
<div class="input-field">
<i class="prefix">{{ field.name[0:1]|upper }}</i>
{{ field.label }}
{{ field(**kwargs)|safe }}
{{ field(data_length='255')|safe }}
</div>
{% if field.errors %}
{% for error in field.errors %}
@ -12,12 +12,10 @@
{% endmacro %}
{% macro render_field_with_value(field, corpus_file) %}
{% set field_name = field.name %}
{{ field_name }}
<div class="input-field">
<i class="prefix">{{ field.name[0:1]|upper }}</i>
{{ field.label }}
{{ field(value=corpus_file[field.name])| safe }}
{{ field(value=corpus_file[field.name], data_length='255')| safe }}
</div>
{% if field.errors %}
{% for error in field.errors %}

View File

@ -7,15 +7,15 @@
</div>
<div class="col s12 m8">
<form method="POST">
<div class="card">
<form method="POST">
<div class="card-content">
{{ edit_corpus_file_form.hidden_tag() }}
<div class="row">
<div class="col s12 m4">
<div class="input-field">
<i class="material-icons prefix">person</i>
{{ edit_corpus_file_form.author(data_length='64', value=corpus_file.author) }}
{{ edit_corpus_file_form.author(data_length='255', value=corpus_file.author) }}
{{ edit_corpus_file_form.author.label }}
{% for error in edit_corpus_file_form.author.errors %}
<span class="helper-text red-text">{{ error }}</span>
@ -25,7 +25,7 @@
<div class="col s12 m4">
<div class="input-field">
<i class="material-icons prefix">title</i>
{{ edit_corpus_file_form.title(data_length='64', value=corpus_file.title) }}
{{ edit_corpus_file_form.title(data_length='255', value=corpus_file.title) }}
{{ edit_corpus_file_form.title.label }}
{% for error in edit_corpus_file_form.title.errors %}
<span class="helper-text red-text">{{ error }}</span>
@ -47,6 +47,7 @@
<div class="card-action right-align">
<button class="btn waves-effect waves-light" id="submit" name="submit" type="submit">Submit<i class="material-icons right">send</i></button>
</div>
</div>
<br>
<ul class="collapsible hoverable">
<li>
@ -62,9 +63,7 @@
or field.name == "csrf_token"
or field.name == "title"
or field.name == "publishing_year") %}
<dl>
{{ render_field_with_value(field, corpus_file)}}
</dl>
{% endfor %}
</div>
</div>
@ -73,6 +72,5 @@
</li>
</ul>
</form>
</div>
</div>
{% endblock %}