def admin_add_organization(): if not model.findOrganization(request.form['name']): model.addOrganization(request.form['name'], request.form['contact_name'], request.form['contact_phone']) else: flash('An organization of that name is already present in the system, and duplicates are not supported') return redirect(url_for('admin_show_organizations'))
def add_organization_json(): if not model.findOrganization(request.form['name']): id = model.addOrganization(request.form['name'], request.form['contact_name'], request.form['contact_phone']) return jsonify({'id': id}) else: return jsonify({'error': {'name': 'An organization of that name is already present in the system, and duplicates are not supported'}})