views.py 291 B

123456789101112
  1. from django.http import HttpResponse
  2. from json import dumps
  3. def multiply(request):
  4. x = int(request.GET['x'])
  5. y = int(request.GET['y'])
  6. retval = x * y
  7. response = {'status': 'success', 'retval': retval}
  8. return HttpResponse(dumps(response), mimetype='application/json')