コード例 #1
0
ファイル: views.py プロジェクト: Nearhan/zerofox
 def form_valid(self, form):
     kwargs = form.cleaned_data
     kwargs['user'] = self.request.user
     resume = Resume(**kwargs)
     self.object = resume.save()
     self.object = resume
     return HttpResponseRedirect(self.get_success_url())
コード例 #2
0
ファイル: api.py プロジェクト: sanchitbareja/occuhunt-web
 def obj_create(self, bundle, **kwargs):
     """
     Creates a new resume
     """
     try:
         user = User.objects.get(id=bundle.data["user"])
         if bundle.data['featured']:
             user.resume_points -= 20
             user.save()
         # need to check if url, anonymous, original supplied
         new_resume = Resume(user=user, url=bundle.data['url'], anonymous=bundle.data['anonymous'], original=bundle.data['original'], featured=bundle.data['featured'], showcase=bundle.data['showcase'])
         new_resume.save()
         bundle.obj = new_resume
     except Exception, e:
         print e
コード例 #3
0
def updateResume(request):
    """
    if not request.user.is_authenticated:
        return HttpResponseRedirect('/manager')
    """

    if request.method == 'GET':
        form = UserApplyStep2Form()
    elif request.method == 'POST':
        form = UserApplyStep2Form(request.POST, request.FILES)
        if form.is_valid():
            files = form.files
            data = form.data
            try:
                candidate = request.user.candidate
            except Candidate.DoesNotExist:
                candidate = Candidate.objects.create(user=user)

            resume = Resume(
                candidate=candidate,
                resume_id=1,
                visible=True,
                gender=data['gender'],
                birth_year=data['birth_year'],
                birth_month=data['birth_month'],
                identity=data['identity'],
                phone_number=data['phone'],
                qq=data['qq'],
                residence=data['residence'],
                email=data['email'],
                #marriaged = data['marriage'],
                degree=data['degree'],
                major=data['major'],
                school=data['school'],
            )
            resume.save()
            messages.add_message(request, messages.SUCCESS,
                                 'Form submmited successfully.')
            return HttpResponseRedirect(reverse('candidate_apply_success'))
    else:
        messages.add_message(
            request, messages.ERROR,
            'A valid application key is required to submit doc' +
            'Please contact the administrator.')
        form = None
    return render(request, 'candidates/updateResume.html', {'form': form})
コード例 #4
0
 def obj_create(self, bundle, **kwargs):
     """
     Creates a new resume
     """
     try:
         user = User.objects.get(id=bundle.data["user"])
         if bundle.data['featured']:
             user.resume_points -= 20
             user.save()
         # need to check if url, anonymous, original supplied
         new_resume = Resume(user=user,
                             url=bundle.data['url'],
                             anonymous=bundle.data['anonymous'],
                             original=bundle.data['original'],
                             featured=bundle.data['featured'],
                             showcase=bundle.data['showcase'])
         new_resume.save()
         bundle.obj = new_resume
     except Exception, e:
         print e
コード例 #5
0
ファイル: update_resumes.py プロジェクト: HackUCF/ppl
    def create_member(self, knights_email, timestamp, url, graduation_date,
                      opted_in):
        try:
            member = Member.objects.get(knights_email__iexact=knights_email)
        except Member.DoesNotExist:
            self.stdout.write('[-] {} not a member!'.format(knights_email))
            return
        try:
            resume = Resume.objects.get(member=member)
            resume.timestamp = timestamp
            resume.url = url
            resume.graduation = graduation_date
        except Resume.DoesNotExist:
            resume = Resume(timestamp=timestamp, member=member, url=url,
                            graduation=graduation_date)
        resume.save()

        for party_name in opted_in.split(', '):
            group, _ = Group.objects.get_or_create(name=party_name)
            party, _ = ResumeShares.objects.get_or_create(group=group)
            resume.shared_with.add(party)
コード例 #6
0
    def create_member(self, knights_email, timestamp, url, graduation_date,
                      opted_in):
        try:
            member = Member.objects.get(knights_email__iexact=knights_email)
        except Member.DoesNotExist:
            self.stdout.write('[-] {} not a member!'.format(knights_email))
            return
        try:
            resume = Resume.objects.get(member=member)
            resume.timestamp = timestamp
            resume.url = url
            resume.graduation = graduation_date
        except Resume.DoesNotExist:
            resume = Resume(timestamp=timestamp,
                            member=member,
                            url=url,
                            graduation=graduation_date)
        resume.save()

        for party_name in opted_in.split(', '):
            group, _ = Group.objects.get_or_create(name=party_name)
            party, _ = ResumeShares.objects.get_or_create(group=group)
            resume.shared_with.add(party)
コード例 #7
0
ファイル: views.py プロジェクト: uiseop/sebako
def created_resume_db(request):
    # ['title','regiNum','issure','dateAcq','file_hash',]
    print(request.POST)
    print(request.POST)
    user = request.user.person.user
    person = get_object_or_404(Person, user_id=user)
    title = request.POST['title']
    regiNum = request.POST['subtitle']
    issure = request.POST['content']
    dateAcq = request.POST['ddate']
    try:
        # API를 통한 통신이 이뤄졋을 경우
        if request.POST['signature']:
            resume = Resume(user=person,
                            title=title,
                            regiNum=regiNum,
                            issure=issure,
                            dateAcq=dateAcq,
                            signature='True')
            message = resume
            context = {
                'message': message,
            }
            resume.save()
            return HttpResponse(status=201)
    except:
        # 블록체인에 올리기만 했을경우
        resume = Resume(
            user=person,
            title=title,
            regiNum=regiNum,
            issure=issure,
            dateAcq=dateAcq,
        )
        message = resume
        context = {
            'message': message,
        }
        resume.save()
        return HttpResponse(status=201)
コード例 #8
0
ファイル: views.py プロジェクト: Nearhan/zerofox
 def create_resume(self, user=None):
     resume = Resume(user=user)
     resume.save()
     return True