now i want to generate random password and send it to mail instead of
simple message
views.py:

from django.shortcuts import render
from profilestorer.settings import EMAIL_HOST_USER
from . import forms
from django.core.mail import send_mail


# Create your views here.
def login(request):
    form = forms.SignInForm()
    return render(request, 'company/login.html', {'form':form})


def register(request):
        form = forms.SignUpForm()
        if request.method == 'POST':
            form = forms.SignUpForm(request.POST)
            form.save()
            subject = 'welcome to profile storer'
            message = 'Hope you find the mail'
            recepient = str(form['Email'].value())
            send_mail(subject,
                message, EMAIL_HOST_USER, [recepient], fail_silently =
False)
            return render(request, 'company/success.html', {'recepient':
recepient})
        return render(request, 'company/register.html', {'form':form})

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMtmBS-TKN%3D_iOJX%3DV-dUcCWxBj_%3Df3kXf_gQDPYt14TnDmRAQ%40mail.gmail.com.
  • [no subject] Paras Jain
    • RE: Kasper Laudrup

Reply via email to