0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 01:46:24 +01:00

Swap around if/else clauses for request==POST and createform_class

This will make it easier to splitout the POST case later...
This commit is contained in:
Matt Westcott 2021-09-10 20:23:56 +01:00 committed by LB (Ben Johnston)
parent 6c5f82bb7b
commit 04a08a7040

View File

@ -572,8 +572,8 @@ class TaskChooserView(View):
'query_string': q,
})
else:
if createform_class:
if request.method == 'POST':
if request.method == 'POST':
if createform_class:
createform = createform_class(request.POST, request.FILES, prefix='create-task')
if createform.is_valid():
@ -586,12 +586,13 @@ class TaskChooserView(View):
return response
else:
createform = createform_class(prefix='create-task')
else:
if request.method == 'POST':
return HttpResponseBadRequest()
createform = None
else: # request is GET
if createform_class:
createform = createform_class(prefix='create-task')
else:
createform = None
searchform = TaskChooserSearchForm(task_type_choices=task_type_choices)
tasks = searchform.task_model.objects.filter(active=True).order_by(Lower('name'))