From 24d74c7e7a48b6c711f5f95f7437c77b744f21a4 Mon Sep 17 00:00:00 2001 From: Nina Menezes Date: Wed, 3 Apr 2024 10:05:29 +0100 Subject: [PATCH] tidy up after rebase --- consultation_analyser/consultations/urls.py | 4 ---- .../consultations/views/pages.py | 3 ++- .../consultations/views/questions.py | 22 ------------------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/consultation_analyser/consultations/urls.py b/consultation_analyser/consultations/urls.py index e77a88a2..60588dbc 100644 --- a/consultation_analyser/consultations/urls.py +++ b/consultation_analyser/consultations/urls.py @@ -10,13 +10,9 @@ questions.show, name="show_question", ), -<<<<<<< HEAD path( "consultations//sections//responses/", questions.show_responses, ), - path("batch-example", views.batch_example, name="batch_example"), -======= path("batch-example", pages.batch_example, name="batch_example"), ->>>>>>> 2540631 (Move views to refactored pages, some tweaks to batch job example view.) ] diff --git a/consultation_analyser/consultations/views/pages.py b/consultation_analyser/consultations/views/pages.py index a6835704..5e93ce32 100644 --- a/consultation_analyser/consultations/views/pages.py +++ b/consultation_analyser/consultations/views/pages.py @@ -1,10 +1,11 @@ from django.http import HttpRequest from django.shortcuts import render -from .. import models from consultation_analyser.batch_calls import BatchJobHandler from consultation_analyser.hosting_environment import HostingEnvironment +from .. import models + def home(request: HttpRequest): questions = models.Question.objects.all().order_by("id")[:10] diff --git a/consultation_analyser/consultations/views/questions.py b/consultation_analyser/consultations/views/questions.py index 4deef2d7..26fbb1f4 100644 --- a/consultation_analyser/consultations/views/questions.py +++ b/consultation_analyser/consultations/views/questions.py @@ -1,13 +1,8 @@ from django.core.paginator import Paginator from django.db.models import Count, Max -<<<<<<< HEAD from django.http import HttpRequest from django.shortcuts import render -from .. import models -======= ->>>>>>> 2540631 (Move views to refactored pages, some tweaks to batch job example view.) - from .. import models @@ -84,20 +79,3 @@ def show_responses(request: HttpRequest, consultation_slug: str, section_slug: s "pagination": current_page, } return render(request, "show_responses.html", context) - - -# TODO - simple view for testing batch jobs -# To be removed once tested -def batch_example(request: HttpRequest): - message = "" - if request.POST: - # TODO - run management command - job_name = "batch_example" - command = ["python", "manage.py", "basic_management_command"] - if not HostingEnvironment.is_local(): - BatchJobHandler.submit_job_batch(jobName=job_name, containerOverrides=command) - message = "Batch job has been run" - else: - message = "Batch job not run locally" - context = {"message": message} - return render(request, "batch_example.html", context)