def renderFund(self, fund_id): fund = Fund.find(fund_id) profile = Profile.find(fund.prof) organization = Organization.find(profile.org) # these stats are inputs and show up in the top part of the page stats_beta = ['Beta'] stats_controlled = ['Alpha', 'RM', 'RF'] stats_curves = ['c_rate', 'd_rate'] # these stats are calculated and show up after calc is clicked stats_calculated = [ 'growth_rate', 'NAV', 'Unfunded', 'Called', 'Distributed' ] stats = {} x = None for stat_name in stats_beta + stats_controlled + stats_curves + stats_calculated: stat = Stat.find_by_name(stat_name, fund_id, 'db') if not stat == None: stats[stat_name] = { 'y': stat.get_values()[1], # 'color_line': stat.color_line, # 'color_fill': stat.color_fill 'color_line': settings.colors[stat_name]['color_line'], 'color_fill': settings.colors[stat_name]['color_fill'] } if x == None: x = stat.get_values()[0] elif stat_name in stats_controlled + stats_beta + stats_curves: stats[stat_name] = { 'y': [1 for x in range(6)], 'color_line': settings.colors[stat_name]['color_line'], 'color_fill': settings.colors[stat_name]['color_fill'] } if x == None: x = [x for x in range(6)] return { 'fund_name': fund.fund_name, 'fund': fund_id, 'prof_name': profile.prof_name, 'org_name': organization.org_name, 'x': x, 'stats': stats, 'stats_beta': stats_beta, 'stats_curves': stats_curves, 'stats_controlled': stats_controlled, 'stats_calculated': stats_calculated }
def post(self): post_data = self.__check_request(request.form) source = string.digits + string.ascii_letters token = ''.join(map(str, [source[randint(0, len(source) -1) ] for x in range(0,18)])) org = Organization.find(1) user = User(name=post_data['name'], mail_address=post_data['mail_address'], password=post_data['password'], token=token, organization_id=org.id ) user.insert() return jsonify(status=200, message='ok', request=request.form, response={'token':token})
def post(self): post_data = self.__check_request(request.form) source = string.digits + string.ascii_letters token = ''.join( map(str, [source[randint(0, len(source) - 1)] for x in range(0, 18)])) org = Organization.find(1) user = User(name=post_data['name'], mail_address=post_data['mail_address'], password=post_data['password'], token=token, organization_id=org.id) user.insert() return jsonify(status=200, message='ok', request=request.form, response={'token': token})