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)
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'})
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')
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)
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
def get_user(email): user_controller = UserController() user = user_controller.get_item(email) return user