def create(self, request): res = Result() #context = self._processRequest(request) ladder = Ladder.objects.get(pk=request.POST.get('lid', None)) red = Team.objects.get(pk=request.POST.get('red', None)) blu = Team.objects.get(pk=request.POST.get('blu', None)) if len(set(red.members.all()).intersection(blu.members.all())) > 0: res.isError = True res.message = CH_SAME_TEAM return JsonResponse(res) game = Game() game.ladder = ladder game.red = red game.blu = blu game.save() res.isSuccess = True res.message = CH_SUCCESS #mail('You have been challenged!', 'ladder/email/game.html', {'object': game}, [user.email for user in game.blu.members.all()]) return JsonResponse(res)