def Signup(request):
    if (request.method == 'POST'):
        form = UserCreationForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            raw_password = form.cleaned_data.get('password1')
            user = authenticate(username=username, password=raw_password)
            login(request, user)
            return redirect('goal_app:goals')
    else:
        context = {'signup_page': 'active'}
        form = UserCreationForm()
    return render(request, 'registration/signup.html', {'form': form})
def Signup(request):
    if (request.method == 'POST'):
        form = UserCreationForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            raw_password = form.cleaned_data.get('password1')
            user = authenticate(username=username, password=raw_password)
            login(request, user)
            return redirect('goal_app:goals')
    else:
        context = {'signup_page': 'active'}
        form = UserCreationForm()
    return render(request, 'registration/signup.html', {'form': form})