1
0

views.py 635 B

12345678910111213141516171819
  1. import requests
  2. from django.http import HttpResponse
  3. from webservice_running.apps import api
  4. from core.settings import API_URL
  5. from webservice_running.forms import OrderRegForm
  6. from django.shortcuts import render
  7. def order_reg(request):
  8. if request.method == 'POST':
  9. form = OrderRegForm(request.POST)
  10. if form.is_valid():
  11. data = request.POST
  12. responce = requests.post(f'{API_URL}/webservice/api/webservice/', data = data, headers=api.headers)
  13. return HttpResponse(responce.text)
  14. else:
  15. form = OrderRegForm()
  16. return render(request, 'webservice_running/order_reg.html', {'form': form})