add data to db
This commit is contained in:
17
app.py
17
app.py
@@ -140,11 +140,6 @@ def getall():
|
|||||||
|
|
||||||
return jsonify(results)
|
return jsonify(results)
|
||||||
|
|
||||||
@app.route('/updateduplicate', methods=['GET', 'POST'])
|
|
||||||
def updateduplicate():
|
|
||||||
if request.method == 'POST':
|
|
||||||
aud = request.form.get('auditory_dubl')
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/vneaud', methods=['GET', 'POST'])
|
@app.route('/vneaud', methods=['GET', 'POST'])
|
||||||
def vneaud():
|
def vneaud():
|
||||||
@@ -200,19 +195,21 @@ def addraspved():
|
|||||||
|
|
||||||
query_string = request.data.decode()
|
query_string = request.data.decode()
|
||||||
|
|
||||||
print(query_string)
|
|
||||||
un_query_string = unquote(unquote(query_string)).split(',')
|
un_query_string = unquote(unquote(query_string)).split(',')
|
||||||
|
|
||||||
print(un_query_string)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ob = db.session.query(Oboruds).filter_by(invNumber=un_query_string[0]).first()
|
ob = db.session.query(Oboruds).filter_by(invNumber=un_query_string[0]).first()
|
||||||
ob.raspologenie=un_query_string[2]
|
|
||||||
ob.numberved=un_query_string[1]
|
ob.numberved=un_query_string[1]
|
||||||
|
ob.kolichestvo = un_query_string[2]
|
||||||
|
ob.balancenumber = un_query_string[3]
|
||||||
|
ob.raspologenie=un_query_string[4]
|
||||||
|
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
db.session.close()
|
db.session.close()
|
||||||
|
|
||||||
|
|
||||||
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function getAllData(){
|
|||||||
let rasp = document.getElementById('modal_rapolog')
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
|
||||||
invnom.innerText = invnomertxt
|
invnom.innerText = invnomertxt
|
||||||
matcen.innerText = nazvanietxt.substring(0,15)
|
matcen.innerText = nazvanietxt.substring(0,20)
|
||||||
|
|
||||||
if (vednumbertxt.length>0){
|
if (vednumbertxt.length>0){
|
||||||
vedomost.value = vednumbertxt;
|
vedomost.value = vednumbertxt;
|
||||||
@@ -93,11 +93,11 @@ $( document ).ready(function() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
vednumber = '';
|
vednumber.value = '';
|
||||||
kolvo = '';
|
kolvo.value = '';
|
||||||
balancenumber = '';
|
balancenumber.value = '';
|
||||||
matcen = '';
|
matcen.value = '';
|
||||||
rasp = '';
|
rasp.value = '';
|
||||||
$('#getmodal').modal('hide')
|
$('#getmodal').modal('hide')
|
||||||
|
|
||||||
|
|
||||||
@@ -137,19 +137,19 @@ $('#modalsavetodb').click(function(){
|
|||||||
data: sendData,
|
data: sendData,
|
||||||
|
|
||||||
success: function(){
|
success: function(){
|
||||||
|
|
||||||
invnom = '';
|
|
||||||
vednumber = '';
|
|
||||||
kolvo = '';
|
|
||||||
balancenumber = '';
|
|
||||||
matcen = '';
|
|
||||||
rasp = '';
|
|
||||||
changeddata = []
|
|
||||||
|
|
||||||
$('#getmodal').modal('hide')
|
$('#getmodal').modal('hide')
|
||||||
|
|
||||||
getAllData();
|
getAllData()
|
||||||
}
|
|
||||||
|
vednumber.value = '';
|
||||||
|
kolvo.value = '';
|
||||||
|
balancenumber.value = '';
|
||||||
|
matcen.value = '';
|
||||||
|
rasp.value = '';
|
||||||
|
changeddata = []
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user