|
|
from django.shortcuts import render
|
|
|
from django.http import HttpResponse
|
|
|
|
|
|
|
|
|
# Create your views here.
|
|
|
|
|
|
def form(request):
|
|
|
if request.method == 'POST':
|
|
|
fullname = request.POST['fullname']
|
|
|
mathematics = int(request.POST['mathematics'])
|
|
|
latvian_lng = int(request.POST['latvian_lng'])
|
|
|
foreign_lng = int(request.POST['foreign_lng'])
|
|
|
if mathematics < 40 or latvian_lng < 40 or foreign_lng < 40:
|
|
|
return HttpResponse(f'{fullname} can not apply to university')
|
|
|
else:
|
|
|
return HttpResponse(f'Hello, {fullname}! You can apply to our university. Your grades: Mathematics: {mathematics}, Latviesu vld: {latvian_lng}, Svesvaloda: {foreign_lng}')
|
|
|
|
|
|
return render(
|
|
|
request,
|
|
|
template_name='form.html',
|
|
|
)
|