Skip to content
Snippets Groups Projects
Commit d83854b2 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

GH-858: Handle the progression of the submissions

parent a6e3e518
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ class ProgressSubmissionForm(forms.ModelForm):
class BatchProgressSubmissionForm(forms.Form):
action = forms.ChoiceField(label='Take action')
submissions = forms.CharField(widget=forms.HiddenInput())
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user')
......@@ -34,6 +35,11 @@ class BatchProgressSubmissionForm(forms.Form):
choices = [(action, detail['display']) for action, detail in ACTION_MAPPING.items()]
self.fields['action'].choices = choices
def clean_submissions(self):
value = self.cleaned_data['submissions']
submission_ids = [int(submission) for submission in value.split(',')]
return ApplicationSubmission.objects.filter(id__in=submission_ids)
class ScreeningSubmissionForm(forms.ModelForm):
......
......@@ -27,7 +27,6 @@ from opentech.apply.activity.messaging import messenger, MESSAGES
from opentech.apply.determinations.views import DeterminationCreateOrUpdateView
from opentech.apply.review.views import ReviewContextMixin
from opentech.apply.users.decorators import staff_required
from opentech.apply.users.models import User
from opentech.apply.utils.views import DelegateableListView, DelegateableView, ViewDispatcher
from .differ import compare
......@@ -133,7 +132,12 @@ class BatchProgressSubmissionView(DelegatedViewMixin, FormView):
context_name = 'batch_progress_form'
def form_valid(self, form):
print('wooooop')
submissions = form.cleaned_data['submissions']
action = form.cleaned_data.get('action')
for submission in submissions:
self.submission.perform_transition(action, self.request.user, request=self.request)
return super().form_valid(form)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment