12345678910111213141516171819202122232425262728 |
- from django.urls import reverse_lazy
- 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, RegisterUserForm
- from django.shortcuts import redirect, 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})
- def registration(request):
- if request.method == 'POST':
- form = RegisterUserForm(request.POST)
- if form.is_valid():
- form.save()
- return redirect('authweb')
- else:
- form = RegisterUserForm()
- return render(request, 'webservice_running/registration.html', {'form': form})
|