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


Python Profile.ssc方法代码示例

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


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

示例1: profile

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import ssc [as 别名]
def profile(request):
    if request.method=="POST":
        form=NameForm(request.POST, request.FILES)
        if form.is_valid():
            name=form.cleaned_data['name']
            surname=form.cleaned_data['surname']
            email=form.cleaned_data['email']
            ssc=form.cleaned_data['ssc']
            inter=form.cleaned_data['inter']
            phone_number=form.cleaned_data['phone_number']
            highest_qualification=form.cleaned_data['highest_qualification']
            docfile=form.cleaned_data['docfile']
            p=Profile()
            p.name=name
            p.surname=surname
            p.email=email
            p.ssc=ssc
            p.inter=inter
            p.phone_number=phone_number
            p.highest_qualification=highest_qualification
            p.docfile=docfile
            p.save()
            print docfile
            from email.mime.text import MIMEText
            #attachment.add_header('Content-Disposition', 'attachment', filename=f) 
            success = "yes"
            subject="profile informayion"
            #url='http://127.0.0.1:8000/resetpwd/'
            url='http://127.0.0.1:8000/resetpwd/{0}'
            html_content='<a href="%s" > download</a>'% url
            body = preprocess_email_body(request,  html_content)
            email = EmailMessage(subject, body, to=[email])
            try:
              #email =EmailMultiAlternatives(subject,body,to=[email])
              email.attach(docfile.name, docfile.read(), docfile.content_type)
              content_subtype = "html"
              #email.attach_alternative(html_content, "text/html")
              #email.attach(attachment)
              email.send()
              #return render(request,"profile.html",locals())       
              success = "yes"
            except Exception as e:
              print e
             
            return render (request,"profile.html",locals())
        else:
            error = "yes"
            print "34233333434", form.errors
    else:
        form=NameForm()
    return render(request,"profile.html",{"form":form})
开发者ID:panjala,项目名称:AMPM,代码行数:53,代码来源:backup_views.py


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