def state_service(): try: country = request.args.get('countryname') countyname = country.split("_")[0] statelist = [] for statename in State.objects(countryname=countyname): statelist.append(statename.state) states = sorted(statelist) return jsonify(statelist) except Exception as e: return jsonify('{"mesg":' + str(e) + '}')
def _update_user_state(chat_id, new_state): State.objects(chat_id=chat_id).update_one(state=new_state)