Esempio n. 1
0
def Exp_Profile(request):
    if request.method=="POST":
        form=ExpForm(request.POST,request.FILES)
        if form.is_valid():
            primary=form.cleaned_data['primary']
            secondary=form.cleaned_data['secondary']
            role=form.cleaned_data['role']
            designation=form.cleaned_data['secondary']
            exp=form.cleaned_data['exp']
            email=form.cleaned_data['email']
            ctc=form.cleaned_data['ctc']
            exp_ctc=form.cleaned_data['exp_ctc']
            reason_for_change=form.cleaned_data['reason_for_change']
            current_company=form.cleaned_data['current_company']
            docfile=form.cleaned_data['docfile']
            e=Exp()
            e.primary=primary
            e.secondary=secondary
            e.role=role
            e.designation= designation
            e.exp=exp
            e.ctc=ctc
            e.exp_ctc=exp_ctc
            e.reason_for_change=reason_for_change
            e.current_company=current_company
            e.email=email
            e.docfile=docfile
            e.save()
            success = "yes"
            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


            success="yes"
            return render (request,"expprofile.html",locals())
        else:
            error = "yes"
            print "34233333434", form.errors
    else:
        form=ExpForm()
    return render(request,"expprofile.html",{"form":form})
Esempio n. 2
0
def exp_view(request):
    if request.method == 'POST':
        f = ExpForm(request.POST)
        if f.is_valid():
            resume = Resume.objects.get(user=request.user)
            model = f.save(commit=False)
            model.resume = resume
            model.save()
            return render_resume(request, tab='exp')
    return redirect('/resume')
Esempio n. 3
0
def render_resume(request, tab='general'):
    resume = Resume.objects.get(user=request.user)
    return render(request, 'resume.html', {
        'general_form': ResumeForm(instance=resume),
        'skill_form': SkillForm(),
        'experience_form': ExpForm(),
        'education_form': EduForm(),
        'language_form': LangForm(),
        'skills': Skill.objects.filter(resume=resume),
        'experience': Experience.objects.filter(resume=resume),
        'education': Education.objects.filter(resume=resume),
        'languages': Language.objects.filter(resume=resume),
        'tab':tab
    })
    
Esempio n. 4
0
def exp_edit_view(request, id = -1):
    if request.method == 'POST':
        f = ExpForm(request.POST, instance=Experience.objects.get(pk=id))
        if f.is_valid():
            f.save()
            return render_resume(request, tab='exp')
    elif id != -1:
        return render(request, 'edit/exp.html', {
            'form': ExpForm(instance=Experience.objects.get(pk=id)),
            'id': id
        });
    return redirect('/resume')