You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
670 B

from django.core.mail import mail_managers
from django.http import JsonResponse
from rest_framework.response import Response
from rest_framework.decorators import api_view
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def call_order(request):
retval = dict(error=False)
try:
mail_managers('Заказали звонок', '''
Имя: {}
Телефон: {}
Время: {}
'''.format(
request.POST['name'],
request.POST['phone'],
request.POST['time'],
))
except Exception as e:
retval = dict(error=True)
return JsonResponse(retval)