/
mybottle.py
34 lines (28 loc) · 879 Bytes
/
mybottle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from bottle import route, run, template, post, get, request
import json
from Job import Job
@route('/index')
def index():
return template('home.tpl', benefit = None)
@post('/index')
def submit_job_posting():
email = request.forms.get('email')
print("email:" + email)
compName = request.forms.get('compName')
print("compName:" + compName)
jobTitle = request.forms.get('jobTitle')
print("jobTitle:" + jobTitle)
skillReq = request.forms.get('skillReq')
openings = request.forms.get('openings')
trainMat = request.forms.get('trainingMaterial')
budget = request.forms.get('budget')
waitTime = request.forms.get('waitTime')
#DB handling
newJob = Job(compName, jobTitle, waitTime, openings, budget, trainMat, skillReq)
if(newJob.save()):
#yay
print("success")
else:
print("error!")
return template('home.tpl',benefit = 2)
run(host='localhost', port=8080)