def umbrella_organisation_new(): if not (current_user.is_authenticated() and current_user.is_aktorregister_admin()): abort(401) flod_activity_types = repo.get_flod_activity_types() brreg_activity_codes = repo.get_brreg_activity_codes() try: return render_flod_template( 'umbrella_organisation_detail.html', umbrella_organisation=json.dumps(None), auth=repo.get_user(current_user.user_id, current_user.user_id), brreg_activity_codes=brreg_activity_codes, flod_activity_types=flod_activity_types ) except requests.exceptions.ConnectionError: app.logger.exception('Request failed') return "", 500
def organisations_list(): allowed_args = ["name", "brreg_activity_code", "flod_activity_type", "area"] params = {} for arg in allowed_args: if arg in request.args and request.args[arg]: params[arg] = request.args[arg] try: flod_activity_types = repo.get_flod_activity_types() brreg_activity_codes = repo.get_brreg_activity_codes() districts = repo.get_districts_without_whole_trd() if params: if current_user.is_anonymous(): user_id = None else: user_id = current_user.user_id organisations = repo.get_all_organisations(params, user_id) else: organisations = [] emails = [] if current_user.is_authenticated() and current_user.is_aktorregister_admin(): emails = [email for email in (o.get('email_address') for o in organisations) if email] emails += [email for email in (o.get('local_email_address') for o in organisations) if email] return render_flod_template( 'organisations_list.html', organisations=organisations, params=params, emails=json.dumps(emails), brreg_activity_codes=brreg_activity_codes, flod_activity_types=flod_activity_types, districts=districts ) except requests.exceptions.ConnectionError: app.logger.exception('Request failed') return "", 500