From cee89dd71275d3a7dcfb26f645a3657316a339bd Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Fri, 10 Jan 2020 11:29:26 +0100 Subject: [PATCH] continue additional metadata --- app/corpora/views.py | 7 ++++--- app/templates/_formhelpers.html.j2 | 6 ++---- app/templates/corpora/edit_corpus_file.html.j2 | 10 ++++------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/corpora/views.py b/app/corpora/views.py index a6670d62..4c1da169 100644 --- a/app/corpora/views.py +++ b/app/corpora/views.py @@ -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(), diff --git a/app/templates/_formhelpers.html.j2 b/app/templates/_formhelpers.html.j2 index 37d4f381..d3aa5c19 100644 --- a/app/templates/_formhelpers.html.j2 +++ b/app/templates/_formhelpers.html.j2 @@ -2,7 +2,7 @@
{{ field.name[0:1]|upper }} {{ field.label }} - {{ field(**kwargs)|safe }} + {{ field(data_length='255')|safe }}
{% 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 }}
{{ field.name[0:1]|upper }} {{ field.label }} - {{ field(value=corpus_file[field.name])| safe }} + {{ field(value=corpus_file[field.name], data_length='255')| safe }}
{% if field.errors %} {% for error in field.errors %} diff --git a/app/templates/corpora/edit_corpus_file.html.j2 b/app/templates/corpora/edit_corpus_file.html.j2 index b098ab54..41e20e7c 100644 --- a/app/templates/corpora/edit_corpus_file.html.j2 +++ b/app/templates/corpora/edit_corpus_file.html.j2 @@ -7,15 +7,15 @@
+
-
{{ edit_corpus_file_form.hidden_tag() }}
person - {{ 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 %} {{ error }} @@ -25,7 +25,7 @@
title - {{ 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 %} {{ error }} @@ -47,6 +47,7 @@
+

  • @@ -62,9 +63,7 @@ or field.name == "csrf_token" or field.name == "title" or field.name == "publishing_year") %} -
    {{ render_field_with_value(field, corpus_file)}} -
    {% endfor %}
@@ -73,6 +72,5 @@ -
{% endblock %}