Add filter to cancel_opes

This commit is contained in:
Ludovic Stephan 2017-04-14 12:43:59 -03:00
parent 034a661444
commit 659b20891e
2 changed files with 7 additions and 5 deletions

View file

@ -45,7 +45,7 @@ class KPsulManager {
var that = this ; var that = this ;
$(this.history).on("cancel_done", function(e) { $(this.history).on("cancel_done", function(e) {
that.reset(true); that.reset(true);
that.focus; that.focus();
}); });
} }

View file

@ -1236,10 +1236,12 @@ def kpsul_cancel_operations(request):
# Checking if BAD REQUEST (opes_pk not int or not existing) # Checking if BAD REQUEST (opes_pk not int or not existing)
try: try:
# Set pour virer les doublons # Set pour virer les doublons
opes_post = set(map(lambda s: int(s), opes_post = (
request.POST.getlist('opes[]', []))) set(map(int, filter(None, request.POST.getlist('opes[]', []))))
transfers_post = set(map(lambda s: int(s), )
request.POST.getlist('transfers[]', []))) transfers_post = (
set(map(int, filter(None, request.POST.getlist('transfers[]', []))))
)
except ValueError: except ValueError:
return JsonResponse(data, status=400) return JsonResponse(data, status=400)