def newjob(): form = forms.ListingForm() form.job_type.choices = [(ob.id, ob.title) for ob in JobType.query.filter_by(public=True).order_by('seq')] form.job_category.choices = [(ob.id, ob.title) for ob in JobCategory.query.filter_by(public=True).order_by('seq')] if request.method == 'GET' or (request.method == 'POST' and request.form.get('form.id') == 'newheadline'): if g.user: form.poster_name.data = g.user.fullname form.poster_email.data = g.user.email if request.method == 'POST' and request.form.get('form.id') != 'newheadline' and form.validate(): # POST request from new job page, with successful validation # Move it to the editjob page for handling here forward post = JobPost(hashid=unique_hash(JobPost), ipaddr=request.environ['REMOTE_ADDR'], useragent=request.user_agent.string) db.session.add(post) return editjob(post.hashid, post.edit_key, form, post, validated=True) elif request.method == 'POST' and request.form.get('form.id') != 'newheadline': # POST request from new job page, with errors flash("Please correct the indicated errors", category='interactive') # Render page. Execution reaches here under three conditions: # 1. GET request, page loaded for the first time # 2. POST request from main page's Post a Job box # 3. POST request from this page, with errors return render_template('postjob.html', form=form, no_removelogo=True)
def newjob(): form = forms.ListingForm() form.job_type.choices = [ (ob.id, ob.title) for ob in JobType.query.filter_by(public=True).order_by('seq') ] form.job_category.choices = [ (ob.id, ob.title) for ob in JobCategory.query.filter_by(public=True).order_by('seq') ] #if request.method == 'POST' and request.form.get('form.id') == 'newheadline': # POST request from the main page's Post a Job box. #form.csrf_token.data = form.generate_csrf_token(session) if request.method == 'POST' and request.form.get( 'form.id') != 'newheadline' and form.validate(): # POST request from new job page, with successful validation # Move it to the editjob page for handling here forward post = JobPost(hashid=unique_hash(JobPost), ipaddr=request.environ['REMOTE_ADDR'], useragent=request.user_agent.string) db.session.add(post) return editjob(post.hashid, post.edit_key, form, post, validated=True) elif request.method == 'POST' and request.form.get( 'form.id') != 'newheadline': # POST request from new job page, with errors flash("Please correct the indicated errors", category='interactive') # Render page. Execution reaches here under three conditions: # 1. GET request, page loaded for the first time # 2. POST request from main page's Post a Job box # 3. POST request from this page, with errors return render_template('postjob.html', form=form, no_removelogo=True)
def newjob(): form = forms.ListingForm() if not g.user: if request.method == 'POST' and request.form.get( 'form.id') == 'newheadline': session['headline'] = form.job_headline.data return redirect( url_for( 'login', next=url_for('newjob'), message= u"Hasjob now requires you to login before listing a job. Please login as yourself." u" We'll add details about your company later")) else: if 'headline' in session: if request.method == 'GET': form.job_headline.data = session.pop('headline') else: session.pop('headline') form.job_type.choices = [ (ob.id, ob.title) for ob in JobType.query.filter_by(public=True).order_by('seq') ] form.job_category.choices = [ (ob.id, ob.title) for ob in JobCategory.query.filter_by(public=True).order_by('seq') ] if request.method == 'GET' or (request.method == 'POST' and request.form.get('form.id') == 'newheadline'): if g.user: # form.poster_name.data = g.user.fullname # Deprecated 2013-11-20 form.poster_email.data = g.user.email if request.method == 'POST' and request.form.get( 'form.id') != 'newheadline' and form.validate(): # POST request from new job page, with successful validation # Move it to the editjob page for handling here forward post = JobPost(hashid=unique_hash(JobPost), ipaddr=request.environ['REMOTE_ADDR'], useragent=request.user_agent.string, user=g.user) db.session.add(post) return editjob(post.hashid, post.edit_key, form, post, validated=True) elif request.method == 'POST' and request.form.get( 'form.id') != 'newheadline': # POST request from new job page, with errors flash("Please correct the indicated errors", category='interactive') # Render page. Execution reaches here under three conditions: # 1. GET request, page loaded for the first time # 2. POST request from main page's Post a Job box # 3. POST request from this page, with errors return render_template('postjob.html', form=form, no_removelogo=True, getuser_autocomplete=lastuser.endpoint_url( lastuser.getuser_autocomplete_endpoint), getuser_userids=lastuser.endpoint_url( lastuser.getuser_userids_endpoint))
def newjob(): form = forms.ListingForm() archived_post = None if not g.user: return redirect(url_for('login', next=url_for('newjob'), message=u"Hasjob now requires you to login before posting a job. Please login as yourself." u" We'll add details about your company later")) else: if g.user.blocked: flash("Your account has been blocked from posting jobs", category='info') return redirect(url_for('index'), code=303) if g.board: if 'new-job' not in g.board.permissions(g.user): abort(403) if g.board and not g.board.require_pay: form.job_pay_type.choices = [(-1, u'Confidential')] + PAY_TYPE.items() form.job_type.choices = JobType.choices(g.board) form.job_category.choices = JobCategory.choices(g.board) if request.method == 'GET': if g.user: # form.poster_name.data = g.user.fullname # Deprecated 2013-11-20 form.poster_email.data = g.user.email # Job Reposting if request.method == 'GET' and request.args.get('template'): archived_post = JobPost.get(request.args['template']) if not archived_post: abort(404) if not archived_post.admin_is(g.user): abort(403) if not archived_post.is_old(): flash("This post is currently active and cannot be posted again.") return redirect(archived_post.url_for(), code=303) form.populate_from(archived_post) if form.validate_on_submit(): # POST request from new job page, with successful validation # Move it to the editjob page for handling here forward newpost = { 'hashid': unique_hash(JobPost), 'ipaddr': request.environ['REMOTE_ADDR'], 'useragent': request.user_agent.string, 'user': g.user } return editjob(hashid=None, key=None, form=form, validated=True, newpost=newpost) elif form.errors: # POST request from new job page, with errors flash("Please review the indicated issues", category='interactive') # Render page. Execution reaches here under three conditions: # 1. GET request, page loaded for the first time # 2. POST request from this page, with errors return render_template('postjob.html', form=form, no_removelogo=True, archived_post=archived_post)
def newjob(): form = forms.ListingForm() if not g.user: if request.method == 'POST' and request.form.get('form.id') == 'newheadline': session['headline'] = form.job_headline.data return redirect(url_for('login', next=url_for('newjob'), message=u"Hasjob now requires you to login before listing a job. Please login as yourself." u" We'll add details about your company later")) else: if g.user.blocked: flash("Your account has been blocked from listing jobs", category='info') return redirect(url_for('index'), code=303) if 'headline' in session: if request.method == 'GET': form.job_headline.data = session.pop('headline') else: session.pop('headline') if g.board: if 'new-job' not in g.board.permissions(g.user): abort(403) if g.board and not g.board.require_pay: form.job_pay_type.choices = [(-1, u'Confidential')] + PAY_TYPE.items() form.job_type.choices = JobType.choices(g.board) form.job_category.choices = JobCategory.choices(g.board) if request.method == 'GET' or (request.method == 'POST' and request.form.get('form.id') == 'newheadline'): if g.user: # form.poster_name.data = g.user.fullname # Deprecated 2013-11-20 form.poster_email.data = g.user.email if request.method == 'POST' and request.form.get('form.id') != 'newheadline' and form.validate(): # POST request from new job page, with successful validation # Move it to the editjob page for handling here forward post = JobPost(hashid=unique_hash(JobPost), ipaddr=request.environ['REMOTE_ADDR'], useragent=request.user_agent.string, user=g.user) db.session.add(post) if g.board: post.add_to(g.board) return editjob(post.hashid, post.edit_key, form, post, validated=True) elif request.method == 'POST' and request.form.get('form.id') != 'newheadline': # POST request from new job page, with errors flash("Please correct the indicated errors", category='interactive') # Render page. Execution reaches here under three conditions: # 1. GET request, page loaded for the first time # 2. POST request from main page's Post a Job box # 3. POST request from this page, with errors return render_template('postjob.html', form=form, no_removelogo=True)
def newjob(): form = forms.ListingForm() if not g.user: if request.method == 'POST' and request.form.get('form.id') == 'newheadline': session['headline'] = form.job_headline.data return redirect(url_for('login', next=url_for('newjob'), message=u"Hasjob now requires you to login before listing a job. Please login as yourself." u" We'll add details about your company later")) else: if 'headline' in session: if request.method == 'GET': form.job_headline.data = session.pop('headline') else: session.pop('headline') form.job_type.choices = [(ob.id, ob.title) for ob in JobType.query.filter_by(public=True).order_by('seq')] form.job_category.choices = [(ob.id, ob.title) for ob in JobCategory.query.filter_by(public=True).order_by('seq')] if request.method == 'GET' or (request.method == 'POST' and request.form.get('form.id') == 'newheadline'): if g.user: # form.poster_name.data = g.user.fullname # Deprecated 2013-11-20 form.poster_email.data = g.user.email if request.method == 'POST' and request.form.get('form.id') != 'newheadline' and form.validate(): # POST request from new job page, with successful validation # Move it to the editjob page for handling here forward post = JobPost(hashid=unique_hash(JobPost), ipaddr=request.environ['REMOTE_ADDR'], useragent=request.user_agent.string, user=g.user) db.session.add(post) return editjob(post.hashid, post.edit_key, form, post, validated=True) elif request.method == 'POST' and request.form.get('form.id') != 'newheadline': # POST request from new job page, with errors flash("Please correct the indicated errors", category='interactive') # Render page. Execution reaches here under three conditions: # 1. GET request, page loaded for the first time # 2. POST request from main page's Post a Job box # 3. POST request from this page, with errors return render_template('postjob.html', form=form, no_removelogo=True, getuser_autocomplete=lastuser.endpoint_url(lastuser.getuser_autocomplete_endpoint), getuser_userids=lastuser.endpoint_url(lastuser.getuser_userids_endpoint))
def newjob(): form = forms.ListingForm() if not g.user: if request.method == 'POST' and request.form.get( 'form.id') == 'newheadline': session['headline'] = form.job_headline.data return redirect( url_for( 'login', next=url_for('newjob'), message= u"Hasjob now requires you to login before posting a job. Please login as yourself." u" We'll add details about your company later")) else: if g.user.blocked: flash("Your account has been blocked from posting jobs", category='info') return redirect(url_for('index'), code=303) if 'headline' in session: if request.method == 'GET': form.job_headline.data = session.pop('headline') else: session.pop('headline') if g.board: if 'new-job' not in g.board.permissions(g.user): abort(403) if g.board and not g.board.require_pay: form.job_pay_type.choices = [(-1, u'Confidential')] + PAY_TYPE.items() form.job_type.choices = JobType.choices(g.board) form.job_category.choices = JobCategory.choices(g.board) if request.method == 'GET' or (request.method == 'POST' and request.form.get('form.id') == 'newheadline'): if g.user: # form.poster_name.data = g.user.fullname # Deprecated 2013-11-20 form.poster_email.data = g.user.email if request.method == 'POST' and request.form.get( 'form.id') != 'newheadline' and form.validate(): # POST request from new job page, with successful validation # Move it to the editjob page for handling here forward newpost = { 'hashid': unique_hash(JobPost), 'ipaddr': request.environ['REMOTE_ADDR'], 'useragent': request.user_agent.string, 'user': g.user } return editjob(hashid=None, key=None, form=form, validated=True, newpost=newpost) elif request.method == 'POST' and request.form.get( 'form.id') != 'newheadline': # POST request from new job page, with errors flash("Please review the indicated issues", category='interactive') # Render page. Execution reaches here under three conditions: # 1. GET request, page loaded for the first time # 2. POST request from main page's Post a Job box # 3. POST request from this page, with errors return render_template('postjob.html', form=form, no_removelogo=True)