from django.shortcuts import render, redirect
from .forms import MembershipApplicationForm

def home(request):
    return render(request, "core/index.html")

def apply_for_membership(request):
    if request.method == 'POST':
        form = MembershipApplicationForm(request.POST)
        if form.is_valid():
            form.save()
            return redirect('application_success')
    else:
        form = MembershipApplicationForm()
    return render(request, 'core/apply.html', {'form': form})

def application_success(request):
    return render(request, 'core/application_success.html')