当前位置: 首页>>代码示例>>Python>>正文


Python Subscription.sendConfirmation方法代码示例

本文整理汇总了Python中models.Subscription.sendConfirmation方法的典型用法代码示例。如果您正苦于以下问题:Python Subscription.sendConfirmation方法的具体用法?Python Subscription.sendConfirmation怎么用?Python Subscription.sendConfirmation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Subscription的用法示例。


在下文中一共展示了Subscription.sendConfirmation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: subscribe

# 需要导入模块: from models import Subscription [as 别名]
# 或者: from models.Subscription import sendConfirmation [as 别名]
def subscribe(request):
	classNumber = request.REQUEST['classNumber']
	theclass = Class.objects.get(number=classNumber)
	try:
		# Subscribe email
		email = request.user.username + "@princeton.edu"
		log.log("subscribeEmail %s %s" % (classNumber, email))
		subscription = Subscription(address = email, theclass = theclass, type = "EMAIL")
		subscription.save()
		subscription.sendConfirmation()
		
		# Subscribe text, if appropriate
		if 'phoneNumber' in request.REQUEST:
			phoneNumber = request.REQUEST['phoneNumber']
			log.log("subscribeText %s %s" % (classNumber, phoneNumber))
			theclass = Class.objects.get(number=classNumber)
			subscription = Subscription(address = phoneNumber, theclass = theclass, type = "TEXT")
			subscription.save()
			subscription.sendConfirmation()
		return HttpResponse("+<b>Success!</b> You will soon receive an email and/or text verifying your subscription for <strong>%s</strong>." % str(theclass))
	except:
		log.log("subscribe ERROR")
		return HttpResponse(traceback.format_exc())
		return HttpResponse("-<b>Something went wrong.</b> You are not subscribed for <strong>%s</strong>. If this problem persists, please <a href='mailto:[email protected]'>contact the developers</a>." % str(theclass))
开发者ID:PrincetonUSG,项目名称:USG-srv-dev,代码行数:26,代码来源:views.py


注:本文中的models.Subscription.sendConfirmation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。