def signup_view(request):
    date = dt.date.today()
    if (request.method == 'POST'):
        form = SignUpForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            password = form.cleaned_data.get('password1')
            name = form.cleaned_data['fullname']
            email = form.cleaned_data['email']
            send_welcome_email(name, email, date)
            user = authenticate(username=username, password=password)
            login(request, user)
            return redirect('main:home')
    else:
        form = SignUpForm()
    return render(request, 'registration/signup.html', {'form': form})
def signup_view(request):
    date = dt.date.today()
    if (request.method == 'POST'):
        form = SignUpForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            password = form.cleaned_data.get('password1')
            name = form.cleaned_data['fullname']
            email = form.cleaned_data['email']
            send_welcome_email(name, email, date)
            user = authenticate(username=username, password=password)
            login(request, user)
            return redirect('main:home')
    else:
        form = SignUpForm()
    return render(request, 'registration/signup.html', {'form': form})