Make publishing year data required again

This commit is contained in:
Patrick Jentsch 2020-10-30 10:58:07 +01:00
parent eb2f47e3a5
commit 79dd307d76
3 changed files with 14 additions and 6 deletions

View File

@ -12,6 +12,8 @@ class AddCorpusFileForm(FlaskForm):
# Required fields # Required fields
author = StringField('Author', validators=[DataRequired(), Length(1, 255)]) author = StringField('Author', validators=[DataRequired(), Length(1, 255)])
file = FileField('File', validators=[DataRequired()]) file = FileField('File', validators=[DataRequired()])
publishing_year = IntegerField('Publishing year',
validators=[DataRequired()])
title = StringField('Title', validators=[DataRequired(), Length(1, 255)]) title = StringField('Title', validators=[DataRequired(), Length(1, 255)])
# Optional fields # Optional fields
address = StringField('Adress', validators=[Length(0, 255)]) address = StringField('Adress', validators=[Length(0, 255)])
@ -22,7 +24,6 @@ class AddCorpusFileForm(FlaskForm):
journal = StringField('Journal', validators=[Length(0, 255)]) journal = StringField('Journal', validators=[Length(0, 255)])
pages = StringField('Pages', validators=[Length(0, 255)]) pages = StringField('Pages', validators=[Length(0, 255)])
publisher = StringField('Publisher', validators=[Length(0, 255)]) publisher = StringField('Publisher', validators=[Length(0, 255)])
publishing_year = IntegerField('Publishing year')
school = StringField('School', validators=[Length(0, 255)]) school = StringField('School', validators=[Length(0, 255)])
submit = SubmitField() submit = SubmitField()
@ -46,6 +47,8 @@ class EditCorpusFileForm(FlaskForm):
''' '''
# Required fields # Required fields
author = StringField('Author', validators=[DataRequired(), Length(1, 255)]) author = StringField('Author', validators=[DataRequired(), Length(1, 255)])
publishing_year = IntegerField('Publishing year',
validators=[DataRequired()])
title = StringField('Title', validators=[DataRequired(), Length(1, 255)]) title = StringField('Title', validators=[DataRequired(), Length(1, 255)])
# Optional fields # Optional fields
address = StringField('Adress', validators=[Length(0, 255)]) address = StringField('Adress', validators=[Length(0, 255)])
@ -56,7 +59,6 @@ class EditCorpusFileForm(FlaskForm):
journal = StringField('Journal', validators=[Length(0, 255)]) journal = StringField('Journal', validators=[Length(0, 255)])
pages = StringField('Pages', validators=[Length(0, 255)]) pages = StringField('Pages', validators=[Length(0, 255)])
publisher = StringField('Publisher', validators=[Length(0, 255)]) publisher = StringField('Publisher', validators=[Length(0, 255)])
publishing_year = IntegerField('Publishing year')
school = StringField('School', validators=[Length(0, 255)]) school = StringField('School', validators=[Length(0, 255)])
submit = SubmitField() submit = SubmitField()

View File

@ -31,6 +31,9 @@
<div class="col s12 m4"> <div class="col s12 m4">
{{ wtf.render_field(add_corpus_file_form.title, data_length='255', material_icon='title') }} {{ wtf.render_field(add_corpus_file_form.title, data_length='255', material_icon='title') }}
</div> </div>
<div class="col s12 m4">
{{ wtf.render_field(add_corpus_file_form.publishing_year, material_icon='access_time') }}
</div>
<div class="col s12"> <div class="col s12">
{{ wtf.render_field(add_corpus_file_form.file, accept='.vrt', placeholder='Choose your .vrt file') }} {{ wtf.render_field(add_corpus_file_form.file, accept='.vrt', placeholder='Choose your .vrt file') }}
</div> </div>
@ -46,7 +49,7 @@
<div class="collapsible-header"><i class="material-icons">add</i>Add additional metadata</div> <div class="collapsible-header"><i class="material-icons">add</i>Add additional metadata</div>
<div class="collapsible-body"> <div class="collapsible-body">
{% for field in add_corpus_file_form {% 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]) }} {{ wtf.render_field(field, data_length='255', material_icon=field.label.text[0:1]) }}
{% endfor %} {% endfor %}
</div> </div>

View File

@ -20,12 +20,15 @@
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<div class="row"> <div class="row">
<div class="col s12 m6"> <div class="col s12 m4">
{{ wtf.render_field(edit_corpus_file_form.author, data_length='255', material_icon='person') }} {{ wtf.render_field(edit_corpus_file_form.author, data_length='255', material_icon='person') }}
</div> </div>
<div class="col s12 m6"> <div class="col s12 m4">
{{ wtf.render_field(edit_corpus_file_form.title, data_length='255', material_icon='title') }} {{ wtf.render_field(edit_corpus_file_form.title, data_length='255', material_icon='title') }}
</div> </div>
<div class="col s12 m4">
{{ wtf.render_field(edit_corpus_file_form.publishing_year, material_icon='access_time') }}
</div>
</div> </div>
</div> </div>
<div class="card-action right-align"> <div class="card-action right-align">
@ -38,7 +41,7 @@
<div class="collapsible-header"><i class="material-icons">edit</i>Edit additional metadata</div> <div class="collapsible-header"><i class="material-icons">edit</i>Edit additional metadata</div>
<div class="collapsible-body"> <div class="collapsible-body">
{% for field in edit_corpus_file_form {% 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]) }} {{ wtf.render_field(field, data_length='255', material_icon=field.label.text[0:1]) }}
{% endfor %} {% endfor %}
</div> </div>