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())
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
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})
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)
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)
def create_resume(self, user=None): resume = Resume(user=user) resume.save() return True