def update_indicator(indicator_id, report_id): print('{} {}'.format(indicator_id, report_id)) form_data = request.form report_indicator = Links.query.filter_by(report=report_id).filter_by( indicator=indicator_id).first() if report_indicator: print('link found') if form_data.get('kill_chain'): print('kill chain {}'.format(form_data.get('kill_chain'))) report_indicator.kill_chain = form_data.get('kill_chain') if form_data.get('confidence'): print('confidence {}'.format(form_data.get('confidence'))) report_indicator.confidence = form_data.get('confidence') if form_data.get('diamond_model'): print('diamond_model {}'.format(form_data.get('diamond_model'))) report_indicator.diamond_model = form_data.get('diamond_model') db.session.commit() db.session.flush() else: report_indicator = Links(report=report_id, indicator=indicator_id) report_indicator.kill_chain = form_data.get('kill_chain', 'Unknown') report_indicator.confidence = form_data.get('confidence', 'Low') report_indicator.diamond_model = form_data.get('diamond_model', 'Unknown') add_db_entry(report_indicator) return 'success'