def index(): form = ContactForm() if form.validate_on_submit(): # This prevents circular imports. from snakeeyes.blueprints.contact.tasks import deliver_contact_email deliver_contact_email.delay(request.form.get('email'), request.form.get('message')) flash('Thanks, expect a response shortly.', 'success') return redirect(url_for('contact.index')) return render_template('contact/index.html', form=form)
def index(): form = ContactForm(obj=current_user) if form.validate_on_submit(): email = form.email.data message = form.message.data data = {"email": email, "message": message} """import send_email here inorder to prevent circular import of celery app""" from snakeeyes.email import contact_me contact_me(email, message, 'contact', 'contact/mail/index', data=data) flash("You will get a response soon", 'success') return redirect(url_for('contact.index')) return render_template('contact/index.html', form=form)
def index(): # Pre-pop if the user is signed-on form = ContactForm(obj=current_user) if form.validate_on_submit(): # This prevents circular imports. from snakeeyes.blueprints.contact.tasks import deliver_contact_email # print "email is: " + request.form.get('email') # print "message is: " + request.form.get('message') current_app.logger.warning('Warning message: submit.') # app.logger.error('An error message is sent.') # app.logger.info('Information: 3 + 2 = %d', 5) deliver_contact_email.delay(request.form.get('email'), request.form.get('message')) flash('Thanks, expect a response shortly.', 'success') return redirect(url_for('contact.index')) current_app.logger.debug('Debug message: Pre-submit.') return render_template('contact/index.html', form=form)