def form_valid(self, form): # here we can add logic to send email print 'GOT TO form_valid' subject_text = "New alter request for " + form.cleaned_data['name_text'] email_text = form.cleaned_data['email_text'] message_text = "Check the admin site for details" try: send_simple_message(subject_text, message_text, ['*****@*****.**', '*****@*****.**'], email_text) except: print sys.exc_info(), traceback.format_exc() return super(CreateView, self).form_valid(form)
def form_valid(self, form): # here we can add logic to send email subject_text = form.cleaned_data['subject_text'] email_text = form.cleaned_data['email_text'] message_text = form.cleaned_data['message_text'] try: send_simple_message(subject_text, message_text, recipient='*****@*****.**', sender=email_text) except: send_simple_message(subject_text, message_text) return super(CreateView, self).form_valid(form)