diff --git a/app/corpora/views.py b/app/corpora/views.py index 2e5e9130..e6c82d77 100644 --- a/app/corpora/views.py +++ b/app/corpora/views.py @@ -85,9 +85,12 @@ def prepare_corpus(corpus_id): corpus = Corpus.query.get_or_404(corpus_id) if not (corpus.creator == current_user or current_user.is_administrator()): abort(403) - corpus.status = 'preparable' - db.session.commit() - flash('Corpus marked for preparation!') + if len(corpus.files.all()) > 0: + corpus.status = 'preparable' + db.session.commit() + flash('Corpus marked for preparation!') + else: + flash('Can not prepare corpus, please add corpus file(s).') return redirect(url_for('corpora.corpus', corpus_id=corpus_id)) diff --git a/app/templates/corpora/corpus.html.j2 b/app/templates/corpora/corpus.html.j2 index 7ab6fcf5..89a2d49b 100644 --- a/app/templates/corpora/corpus.html.j2 +++ b/app/templates/corpora/corpus.html.j2 @@ -24,7 +24,9 @@ {% if corpus.status == 'prepared' %} helpAnalyse {% endif %} + {% if corpus.files[0] is defined %} whatshotPrepare + {% endif %} deleteDelete Corpus