Skip to content

Commit

Permalink
tidy up after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nmenezes0 committed Apr 3, 2024
1 parent a2e88d4 commit 24d74c7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
4 changes: 0 additions & 4 deletions consultation_analyser/consultations/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@
questions.show,
name="show_question",
),
<<<<<<< HEAD
path(
"consultations/<str:consultation_slug>/sections/<str:section_slug>/responses/<str:question_slug>",
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.)
]
3 changes: 2 additions & 1 deletion consultation_analyser/consultations/views/pages.py
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
22 changes: 0 additions & 22 deletions consultation_analyser/consultations/views/questions.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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)

0 comments on commit 24d74c7

Please sign in to comment.