36781-vm/core/views.py
Flatlogic Bot 02525633d4 harsh
2025-12-09 06:05:51 +00:00

25 lines
969 B
Python

from django.shortcuts import render, redirect
from .models import Tourist
def index(request):
if request.method == 'POST':
name = request.POST.get('name')
email = request.POST.get('email')
emergency_contact_name = request.POST.get('emergency_contact_name')
emergency_contact_phone = request.POST.get('emergency_contact_phone')
if name and email and emergency_contact_name and emergency_contact_phone:
if not Tourist.objects.filter(email=email).exists():
Tourist.objects.create(
name=name,
email=email,
emergency_contact_name=emergency_contact_name,
emergency_contact_phone=emergency_contact_phone
)
return redirect('registration_success')
return render(request, 'core/index.html')
def registration_success(request):
return render(request, 'core/registration_success.html')