def edit_party(party_id): if request.method == 'POST': name = request.form.get('name') gstin = request.form.get('gstin') address = request.form.get('local_address') state = request.form.get('state') country = request.form.get('country') pincode = request.form.get('pincode') contact_person_name = request.form.get('contact_person_name') email = request.form.get('email') mobile_no_1 = request.form.get('mobile_no_1') mobile_no_2 = request.form.get('mobile_no_2') city = request.form.get('city') id = party_id party = Party(name, gstin, address, city, state, country, int(pincode), contact_person_name, mobile_no_1, email, mobile_no_2, party_id) party.save_to_mongo() return redirect(url_for('.index')) return render_template('party/edit_party.jinja2', new_party_page=True, party=Party.get_by_id(party_id))
def new_party(): if request.method == 'POST': name = request.form.get('name') gstin = request.form.get('gstin') address = request.form.get('local_address') state = request.form.get('state') country = request.form.get('country') pincode = request.form.get('pincode') contact_person_name = request.form.get('contact_person_name') email = request.form.get('email') mobile_no_1 = request.form.get('mobile_no_1') mobile_no_2 = request.form.get('mobile_no_2') city = request.form.get('city') party = Party(name, gstin, address, city, state, country, int(pincode), contact_person_name, mobile_no_1, email, mobile_no_2) party.save_to_mongo() #f = request.form #print(f) #for key in f.keys(): # for value in f.getlist(key): # print(key,value) return redirect(url_for('.index')) return render_template('party/new_party.jinja2', new_party_page=True)