Пример #1
0
def create_event_page_handler():
    print 'In create event page'
    userController = UserController()
    user = userController.get_item(session['email']) if 'email' in session else None
    spaceController = SpaceController()
    spaces = spaceController.get_items()
    return render_template("create_event.html", user=user, spaces=spaces)
Пример #2
0
def user_login_handler():
    email = request.form['email']
    controller = UserController()
    user = controller.get_item(email)
    if user:
        session['email'] = email
        return redirect('/grind')
    else:
        return jsonify({'success': False, 'message': 'Email not in database'})
Пример #3
0
def index():
    print 'In index page'
    userController = UserController()
    user = userController.get_item(session['email']) if 'email' in session else None
    message = request.args.get('message', None)
    if not user:
        return render_template("index.html", user=user, message=message)
    else:
        return redirect('/grind')
Пример #4
0
def get_users_for_industry():
    industry = request.form['industry']
    controller = UserController()
    industry_users = controller.get_items_for_industry(industry)
    print industry_users
    users = []
    for user in industry_users:
        print user['first_name'] + ' , ' + user['last_name']
        users.append(user['first_name'] + ' , ' + user['last_name'])
    return jsonify({'Users belonging to '+industry:users})
Пример #5
0
def grind():
    print 'In grind page'
    controller = SpaceController()
    spaces = controller.get_items()
    userController = UserController()
    user = userController.get_item(session['email']) if 'email' in session else None
    deals_list = HubspotAPI().get_deals()
    deals = []
    for deal in deals_list:
        deals.append({'id':deal["dealId"],'name':deal["properties"]["dealname"]["value"]})
    deal_stages = ['appointmentscheduled','qualifiedtobuy','presentationscheduled','decisionmakerboughtin','contractsent','closedwon','closedlost']
    return render_template("grind.html", spaces=spaces, user=user, deals=deals, deal_stages=deal_stages)
Пример #6
0
def create_user(email, first_name, last_name, **kwargs):
    user_controller = UserController()
    user = user_controller.get_item(email)
    if not user:
        user = user_controller.create_item(email=email, first_name=first_name, last_name=last_name, **kwargs)
    return user
Пример #7
0
def get_user(email):
    user_controller = UserController()
    user = user_controller.get_item(email)
    return user