本文整理汇总了Python中models.Feedback.email方法的典型用法代码示例。如果您正苦于以下问题:Python Feedback.email方法的具体用法?Python Feedback.email怎么用?Python Feedback.email使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Feedback
的用法示例。
在下文中一共展示了Feedback.email方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: contact
# 需要导入模块: from models import Feedback [as 别名]
# 或者: from models.Feedback import email [as 别名]
def contact(request):
if request.method == 'POST':
c={}
form = ContactForm(request.POST)
if form.is_valid():
feedback = Feedback()
try:
feedback.name = form.cleaned_data["con_name"]
feedback.email = form.cleaned_data["con_emailid"]
try:
feedback.mobile = str(form.cleaned_data["con_mobile"])
except:
feedback.mobile = ""
#if feedback.mobile is None:
# feedback.mobile = 0
feedback.value = form.cleaned_data["con_text"]
feedback.save()
c.update({"success":True})
except:
print sys.exc_info()[1]
return HttpResponse('Error in sending feedback'+str(vars(feedback))+str(sys.exc_info()[0]))
c.update(csrf(request))
return render_to_response('contact.html',c)
else:
c={}
c.update({"form":form})
c.update(csrf(request))
return render_to_response('contact.html',c)
c={}
c.update(csrf(request))
return render_to_response('contact.html',c)
示例2: post
# 需要导入模块: from models import Feedback [as 别名]
# 或者: from models.Feedback import email [as 别名]
def post(self):
from recaptcha.client import captcha
captcha_challenge_field = self.get_argument('recaptcha_challenge_field')
captcha_response_field = self.get_argument('recaptcha_response_field')
captcha_response = captcha.submit(
captcha_challenge_field,
captcha_response_field,
configuration.RECAPTCHA_PRIVATE_KEY,
self.request.remote_ip
)
if captcha_response.is_valid:
full_name = self.get_argument('name')
email = self.get_argument('email')
subject = self.get_argument('subject')
content = self.get_argument('content')
feedback = Feedback()
feedback.full_name = full_name
feedback.email = email
feedback.subject = subject
feedback.content = content
feedback.put()
self.redirect('/')
else:
error = captcha_response.error_code
self.redirect('/contact/feedback?captcha_error=%s' % error)
示例3: post
# 需要导入模块: from models import Feedback [as 别名]
# 或者: from models.Feedback import email [as 别名]
def post(self):
full_name = self.get_argument('full_name')
email = self.get_argument('email')
phone_number = self.get_argument('phone_number')
subject = self.get_argument('subject')
comment = self.get_argument('comment')
from models import Feedback
feedback = Feedback()
feedback.full_name = full_name
feedback.email = email
feedback.phone_number = phone_number
feedback.subject = subject
feedback.comment = comment
feedback.put()
self.redirect("/")
示例4: add
# 需要导入模块: from models import Feedback [as 别名]
# 或者: from models.Feedback import email [as 别名]
def add(request):
"""Gather feedback for a page, and if it is ok show a thanks message and link back to the page."""
submit_was_success = False
return_to_url = None
# If it is a post request try to create the feedback
if request.method == 'POST':
form = FeedbackForm( request.POST )
if form.is_valid():
feedback = Feedback()
feedback.url = form.cleaned_data['url']
feedback.email = form.cleaned_data['email']
feedback.comment = form.cleaned_data['comment']
# if there is any content in the honeypot field then label this comment as spammy
if form.cleaned_data['website']:
feedback.status = 'spammy'
# if the comment starts with an html tag it is probably spam
if re.search('\A\s*<\w+>', form.cleaned_data['comment']):
feedback.status = 'spammy'
if request.user.is_authenticated():
feedback.user = request.user
feedback.save()
submit_was_success = True
return_to_url = feedback.url or None
else:
# use GET to grab the url if set
form = FeedbackForm(initial=request.GET)
return render_to_response(
'feedback/add.html',
{
'form': form,
'submit_was_success': submit_was_success,
'return_to_url': return_to_url,
},
context_instance=RequestContext(request)
)