From 7dbbf9db4802afd9594d410d4c5b81ff9ba474af Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Fri, 18 Nov 2022 13:28:58 +0100 Subject: [PATCH] Let everyone upload new models --- app/contributions/forms.py | 3 --- app/contributions/routes.py | 7 ++++--- app/templates/_sidenav.html.j2 | 4 +--- app/templates/contributions/contributions.html.j2 | 2 ++ .../contributions/create_spacy_nlp_pipeline_model.html.j2 | 5 ----- .../create_tesseract_ocr_pipeline_model.html.j2 | 5 ----- .../contributions/spacy_nlp_pipeline_model.html.j2 | 5 ----- .../contributions/tesseract_ocr_pipeline_model.html.j2 | 5 ----- 8 files changed, 7 insertions(+), 29 deletions(-) diff --git a/app/contributions/forms.py b/app/contributions/forms.py index 2c22f56e..0ba8f5d5 100644 --- a/app/contributions/forms.py +++ b/app/contributions/forms.py @@ -45,9 +45,6 @@ class ContributionBaseForm(FlaskForm): compatible_service_versions = SelectMultipleField( 'Compatible service versions' ) - shared = BooleanField( - 'Shared' - ) submit = SubmitField() diff --git a/app/contributions/routes.py b/app/contributions/routes.py index e0daf969..0c4b230b 100644 --- a/app/contributions/routes.py +++ b/app/contributions/routes.py @@ -27,7 +27,6 @@ from .forms import ( @bp.before_request @login_required -@permission_required(Permission.CONTRIBUTE) def before_request(): pass @@ -105,7 +104,7 @@ def create_tesseract_ocr_pipeline_model(): publisher_url=form.publisher_url.data, publishing_url=form.publishing_url.data, publishing_year=form.publishing_year.data, - shared=form.shared.data, + shared=False, title=form.title.data, version=form.version.data, user=current_user @@ -127,6 +126,7 @@ def create_tesseract_ocr_pipeline_model(): ) @bp.route('/tesseract-ocr-pipeline-models//toggle-public-status', methods=['POST']) +@permission_required(Permission.CONTRIBUTE) def toggle_tesseract_ocr_pipeline_model_public_status(tesseract_ocr_pipeline_model_id): tesseract_ocr_pipeline_model = TesseractOCRPipelineModel.query.get_or_404(tesseract_ocr_pipeline_model_id) if not (tesseract_ocr_pipeline_model.user == current_user or current_user.is_administrator()): @@ -201,7 +201,7 @@ def create_spacy_nlp_pipeline_model(): publisher_url=form.publisher_url.data, publishing_url=form.publishing_url.data, publishing_year=form.publishing_year.data, - shared=form.shared.data, + shared=False, title=form.title.data, version=form.version.data, user=current_user @@ -223,6 +223,7 @@ def create_spacy_nlp_pipeline_model(): ) @bp.route('/spacy-nlp-pipeline-models//toggle-public-status', methods=['POST']) +@permission_required(Permission.CONTRIBUTE) def toggle_spacy_nlp_pipeline_model_public_status(spacy_nlp_pipeline_model_id): spacy_nlp_pipeline_model = SpaCyNLPPipelineModel.query.get_or_404(spacy_nlp_pipeline_model_id) if not (spacy_nlp_pipeline_model.user == current_user or current_user.is_administrator()): diff --git a/app/templates/_sidenav.html.j2 b/app/templates/_sidenav.html.j2 index 553eb9db..b0ea6de8 100644 --- a/app/templates/_sidenav.html.j2 +++ b/app/templates/_sidenav.html.j2 @@ -12,6 +12,7 @@
  • dashboardDashboard
  • IMy Corpora
  • JMy Jobs
  • +
  • new_labelContribute
  • Processes & Services
  • File setup
  • @@ -34,7 +35,4 @@ {% if current_user.can(Permission.USE_API) %}
  • apiAPI
  • {% endif %} - {% if current_user.can(Permission.CONTRIBUTE) %} -
  • new_labelContribute
  • - {% endif %} diff --git a/app/templates/contributions/contributions.html.j2 b/app/templates/contributions/contributions.html.j2 index 64f1fac6..4e513b9e 100644 --- a/app/templates/contributions/contributions.html.j2 +++ b/app/templates/contributions/contributions.html.j2 @@ -29,6 +29,7 @@ + {% endblock page_content %} diff --git a/app/templates/contributions/create_spacy_nlp_pipeline_model.html.j2 b/app/templates/contributions/create_spacy_nlp_pipeline_model.html.j2 index 9a0bcddd..c1f452d3 100644 --- a/app/templates/contributions/create_spacy_nlp_pipeline_model.html.j2 +++ b/app/templates/contributions/create_spacy_nlp_pipeline_model.html.j2 @@ -72,11 +72,6 @@
    {{ wtf.render_field(form.compatible_service_versions) }}
    -
    -

    -
    - {{ wtf.render_field(form.shared) }} -
    diff --git a/app/templates/contributions/create_tesseract_ocr_pipeline_model.html.j2 b/app/templates/contributions/create_tesseract_ocr_pipeline_model.html.j2 index 9a04b535..e4c5a04b 100644 --- a/app/templates/contributions/create_tesseract_ocr_pipeline_model.html.j2 +++ b/app/templates/contributions/create_tesseract_ocr_pipeline_model.html.j2 @@ -69,11 +69,6 @@
    {{ wtf.render_field(form.compatible_service_versions) }}
    -
    -

    -
    - {{ wtf.render_field(form.shared) }} -
    diff --git a/app/templates/contributions/spacy_nlp_pipeline_model.html.j2 b/app/templates/contributions/spacy_nlp_pipeline_model.html.j2 index 718fe7de..32f27303 100644 --- a/app/templates/contributions/spacy_nlp_pipeline_model.html.j2 +++ b/app/templates/contributions/spacy_nlp_pipeline_model.html.j2 @@ -44,11 +44,6 @@
    {{ wtf.render_field(form.compatible_service_versions) }}
    -
    -

    -
    - {{ wtf.render_field(form.shared) }} -
    diff --git a/app/templates/contributions/tesseract_ocr_pipeline_model.html.j2 b/app/templates/contributions/tesseract_ocr_pipeline_model.html.j2 index ae2432dc..02322d8a 100644 --- a/app/templates/contributions/tesseract_ocr_pipeline_model.html.j2 +++ b/app/templates/contributions/tesseract_ocr_pipeline_model.html.j2 @@ -41,11 +41,6 @@
    {{ wtf.render_field(form.compatible_service_versions) }}
    -
    -

    -
    - {{ wtf.render_field(form.shared) }} -