本文整理汇总了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))