mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development
This commit is contained in:
commit
8c69c3881f
@ -33,8 +33,20 @@ class AddCorpusForm(FlaskForm):
|
||||
title = StringField('Title', validators=[DataRequired(), Length(1, 32)])
|
||||
|
||||
|
||||
class EditCorpusFileForm(AddCorpusFileForm):
|
||||
pass
|
||||
class EditCorpusFileForm(FlaskForm):
|
||||
address = StringField('Adress', validators=[Length(0, 255)])
|
||||
author = StringField('Author', validators=[DataRequired(), Length(1, 255)])
|
||||
booktitle = StringField('Booktitle', validators=[Length(0, 255)])
|
||||
chapter = StringField('Chapter', validators=[Length(0, 255)])
|
||||
editor = StringField('Editor', validators=[Length(0, 255)])
|
||||
institution = StringField('institution', validators=[Length(0, 255)])
|
||||
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', validators=[DataRequired()])
|
||||
school = StringField('School', validators=[Length(0, 255)])
|
||||
submit = SubmitField()
|
||||
title = StringField('Title', validators=[DataRequired(), Length(1, 255)])
|
||||
|
||||
|
||||
class QueryForm(FlaskForm):
|
||||
|
@ -166,8 +166,17 @@ def edit_corpus_file(corpus_id, corpus_file_id):
|
||||
abort(403)
|
||||
edit_corpus_file_form = EditCorpusFileForm()
|
||||
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
|
||||
ids = [field.id for field in edit_corpus_file_form if not
|
||||
(field.id == 'submit'
|
||||
or field.id == "csrf_token"
|
||||
or field.id == "file")]
|
||||
data = [field.data for field in edit_corpus_file_form if not
|
||||
(field.id == 'submit'
|
||||
or field.id == "csrf_token"
|
||||
or field.id == "file")]
|
||||
field_dict = dict(zip(ids, data))
|
||||
stmt = db.update(CorpusFile).where(CorpusFile.id==corpus_file_id).values(**field_dict)
|
||||
db.session.execute(stmt)
|
||||
db.session.commit()
|
||||
thread = Thread(target=edit_corpus_file_,
|
||||
args=(current_app._get_current_object(),
|
||||
|
Loading…
Reference in New Issue
Block a user