本文整理匯總了Python中models.Email.email方法的典型用法代碼示例。如果您正苦於以下問題:Python Email.email方法的具體用法?Python Email.email怎麽用?Python Email.email使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Email
的用法示例。
在下文中一共展示了Email.email方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: cadastrar_newsletter_ajax
# 需要導入模塊: from models import Email [as 別名]
# 或者: from models.Email import email [as 別名]
def cadastrar_newsletter_ajax(request):
try:
email = strip_tags(request.POST['email'])
nome = strip_tags(request.POST['nome'])
try:
cadastro = Email.objects.get(email = email)
resposta = "email_existente"
except Email.DoesNotExist:
novo_cadastro = Email()
novo_cadastro.email = email
novo_cadastro.nome = nome
novo_cadastro.save()
resposta = "sucesso"
except Exception:
resposta = "falha"
pass
return HttpResponse(resposta)