From 79dd307d761460df2b02a7d601d47bbf54d06187 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Fri, 30 Oct 2020 10:58:07 +0100
Subject: [PATCH] Make publishing year data required again
---
web/app/corpora/forms.py | 6 ++++--
web/app/templates/corpora/add_corpus_file.html.j2 | 5 ++++-
web/app/templates/corpora/corpus_file.html.j2 | 9 ++++++---
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/web/app/corpora/forms.py b/web/app/corpora/forms.py
index 0a2e2170..14c22f1b 100644
--- a/web/app/corpora/forms.py
+++ b/web/app/corpora/forms.py
@@ -12,6 +12,8 @@ class AddCorpusFileForm(FlaskForm):
# Required fields
author = StringField('Author', validators=[DataRequired(), Length(1, 255)])
file = FileField('File', validators=[DataRequired()])
+ publishing_year = IntegerField('Publishing year',
+ validators=[DataRequired()])
title = StringField('Title', validators=[DataRequired(), Length(1, 255)])
# Optional fields
address = StringField('Adress', validators=[Length(0, 255)])
@@ -22,7 +24,6 @@ class AddCorpusFileForm(FlaskForm):
journal = StringField('Journal', validators=[Length(0, 255)])
pages = StringField('Pages', validators=[Length(0, 255)])
publisher = StringField('Publisher', validators=[Length(0, 255)])
- publishing_year = IntegerField('Publishing year')
school = StringField('School', validators=[Length(0, 255)])
submit = SubmitField()
@@ -46,6 +47,8 @@ class EditCorpusFileForm(FlaskForm):
'''
# Required fields
author = StringField('Author', validators=[DataRequired(), Length(1, 255)])
+ publishing_year = IntegerField('Publishing year',
+ validators=[DataRequired()])
title = StringField('Title', validators=[DataRequired(), Length(1, 255)])
# Optional fields
address = StringField('Adress', validators=[Length(0, 255)])
@@ -56,7 +59,6 @@ class EditCorpusFileForm(FlaskForm):
journal = StringField('Journal', validators=[Length(0, 255)])
pages = StringField('Pages', validators=[Length(0, 255)])
publisher = StringField('Publisher', validators=[Length(0, 255)])
- publishing_year = IntegerField('Publishing year')
school = StringField('School', validators=[Length(0, 255)])
submit = SubmitField()
diff --git a/web/app/templates/corpora/add_corpus_file.html.j2 b/web/app/templates/corpora/add_corpus_file.html.j2
index 5f8f25b3..70f72834 100644
--- a/web/app/templates/corpora/add_corpus_file.html.j2
+++ b/web/app/templates/corpora/add_corpus_file.html.j2
@@ -31,6 +31,9 @@
{{ wtf.render_field(add_corpus_file_form.title, data_length='255', material_icon='title') }}
+
+ {{ wtf.render_field(add_corpus_file_form.publishing_year, material_icon='access_time') }}
+
{{ wtf.render_field(add_corpus_file_form.file, accept='.vrt', placeholder='Choose your .vrt file') }}
@@ -46,7 +49,7 @@
{% for field in add_corpus_file_form
- if field.short_name not in ['author', 'csrf_token', 'file', 'submit', 'title'] %}
+ if field.short_name not in ['author', 'csrf_token', 'file', 'publishing_year', 'submit', 'title'] %}
{{ wtf.render_field(field, data_length='255', material_icon=field.label.text[0:1]) }}
{% endfor %}
diff --git a/web/app/templates/corpora/corpus_file.html.j2 b/web/app/templates/corpora/corpus_file.html.j2
index 810816fe..4f02a085 100644
--- a/web/app/templates/corpora/corpus_file.html.j2
+++ b/web/app/templates/corpora/corpus_file.html.j2
@@ -20,12 +20,15 @@
-
+
{{ wtf.render_field(edit_corpus_file_form.author, data_length='255', material_icon='person') }}
-
+
{{ wtf.render_field(edit_corpus_file_form.title, data_length='255', material_icon='title') }}
+
+ {{ wtf.render_field(edit_corpus_file_form.publishing_year, material_icon='access_time') }}
+
@@ -38,7 +41,7 @@
{% for field in edit_corpus_file_form
- if field.short_name not in ['author', 'csrf_token', 'submit', 'title'] %}
+ if field.short_name not in ['author', 'csrf_token', 'publishing_year', 'submit', 'title'] %}
{{ wtf.render_field(field, data_length='255', material_icon=field.label.text[0:1]) }}
{% endfor %}