import requests from django.http import HttpResponse from webservice_running.apps import api from core.settings import API_URL from webservice_running.forms import OrderRegForm from django.shortcuts import render def order_reg(request): if request.method == 'POST': form = OrderRegForm(request.POST) if form.is_valid(): data = request.POST responce = requests.post(f'{API_URL}/webservice/api/webservice/', data = data, headers=api.headers) return HttpResponse(responce.text) else: form = OrderRegForm() return render(request, 'webservice_running/order_reg.html', {'form': form})