from django.shortcuts import render
from django.http import HttpResponse
from .forms import SiteUserForm


def index(request):
    if request.method == 'POST':
        form = SiteUserForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponse("User was created successfully.")
        else:
            return HttpResponse("There was an error.")
    else:
        form = SiteUserForm()

    return render(request, 'account.html', {'form': form})


# def index(request):
#     return render(request, 'account.html')
