diff --git a/__pycache__/app.cpython-312.pyc b/__pycache__/app.cpython-312.pyc new file mode 100644 index 0000000..db03f4d Binary files /dev/null and b/__pycache__/app.cpython-312.pyc differ diff --git a/__pycache__/models.cpython-312.pyc b/__pycache__/models.cpython-312.pyc new file mode 100644 index 0000000..cbaca55 Binary files /dev/null and b/__pycache__/models.cpython-312.pyc differ diff --git a/app.py b/app.py index ab6e300..2f96d60 100644 --- a/app.py +++ b/app.py @@ -175,44 +175,23 @@ def zamsearch(): p = request.form.get('srch') searchedZam = db.session.query(Zametki).filter( - Zametki.txtzam.contains(p)).all() - + Zametki.txtzam.contains(p)).ll() zam = [] - for item in searchedZam: - zam.append([item.txtzam, item.created_date]) - + zam.append([item.txtzam, item.created_date]) return render_template('zametki.html', zam=zam) - # ================================================================================== -# Выгрузка в пдф - -@app.route('/pdfexport') -def pdfexport(): - auds = db.session.query(Auditory).all() - print(auds) - for aud in auds: - q = db.session.query(Auditory, Oboruds).filter( - Auditory.id == Oboruds.aud_id - ).filter(Auditory.id == aud.id - ).order_by(Oboruds.invNumber).all() - print(q) - - results = [] - for auditory, oboruds in q: - results.append({ - 'auditory_id': auditory.id, - 'auditory_name': auditory.audnazvanie, - 'inv_number': oboruds.invNumber, - 'oboruds_id': oboruds.nazvanie, - }) - html = render_template('searchonaud.html', aud=auds, res=results) - - return render_pdf(HTML(string=html)) +def ranomraspr(): + with app.app_context(): + while len(db.session.query(Oboruds).filter(Oboruds.aud_id == None).all()) > 0: + audid = random.choice(db.session.query(Auditory).all()) + oborud = random.choice(db.session.query(Oboruds).filter(Oboruds.aud_id == None).all()) + oborud.aud_id = audid.id + db.session.commit() + -# ================================================================================== def createdb(): with app.app_context(): db.create_all() @@ -247,66 +226,28 @@ def createdb(): db.session.commit() - #with open('inventMavrin.csv', encoding='cp1251') as csv_file: - # csv_reader = csv.reader(csv_file, delimiter=';') - # for row in csv_reader: - # db.session.add( - # Oboruds(invNumber=row[0], nazvanie=row[1], typeBalanse='баланс')) - #db.session.commit() - - -def updateOborud(): - with app.app_context(): - db.session.query(Oboruds).update({Oboruds.typeBalanse: 'баланс'}) + with open('inventMavrin.csv', encoding='cp1251') as csv_file: + csv_reader = csv.reader(csv_file, delimiter=';') + for row in csv_reader: + db.session.add( + Oboruds(invNumber=row[0], nazvanie=row[1], typeBalanse='баланс')) + db.session.commit() - - -def addZabalans(): - with app.app_context(): + + """ with open('zabalans.csv', encoding='utf-8') as csv_file: csv_reader = csv.reader(csv_file, delimiter=';') for row in csv_reader: print(row) db.session.add( - Oboruds(invNumber=row[0], nazvanie=row[1], typeBalanse="забаланс")) + Oboruds(invNumber=row[0], nazvanie=row[1], typeBalanse="забаланс")) - db.session.commit() - - -def randomraspr(): - with app.app_context(): - while db.session.query(Oboruds).filter(Oboruds.aud_id == None).all(): - audid = random.choice(db.session.query(Auditory).all()) - oborud = random.choice(db.session.query( - Oboruds).filter(Oboruds.aud_id == None).all()) - oborud.aud_id = audid.id - - db.session.commit() - - -def randomzam(): - files = ['cf.txt', 'ci.txt', 'co.txt'] - - fio = [] - for i in range(20): - tmp = [] - for file in files: - f = open(file, "r", encoding="utf-8").readlines() - tmp.append(random.choice(f)) - - fio.append((''.join(tmp)).replace('\n', ' ').replace('\t', '')) - - print(fio) - - for item in fio: - timeadd = datetime.now(timezone.utc) - with app.app_context(): - db.session.add(Zametki(txtzam=item, created_date=timeadd)) - db.session.commit() - -# ================================== + db.session.commit() + """ if __name__ == '__main__': - app.run(debug=True, host='0.0.0.0', port='3800') + #ranomraspr() + #createdb() + app.run(debug=True, host='0.0.0.0', port='3800') diff --git a/migrations/__pycache__/env.cpython-312.pyc b/migrations/__pycache__/env.cpython-312.pyc index 9fe933a..d40e79f 100644 Binary files a/migrations/__pycache__/env.cpython-312.pyc and b/migrations/__pycache__/env.cpython-312.pyc differ diff --git a/migrations/versions/__pycache__/256c3a3e91a2_.cpython-312.pyc b/migrations/versions/__pycache__/256c3a3e91a2_.cpython-312.pyc new file mode 100644 index 0000000..77081c0 Binary files /dev/null and b/migrations/versions/__pycache__/256c3a3e91a2_.cpython-312.pyc differ diff --git a/migrations/versions/__pycache__/4f95d12a8352_.cpython-312.pyc b/migrations/versions/__pycache__/4f95d12a8352_.cpython-312.pyc new file mode 100644 index 0000000..2889172 Binary files /dev/null and b/migrations/versions/__pycache__/4f95d12a8352_.cpython-312.pyc differ diff --git a/migrations/versions/__pycache__/50f85881169e_.cpython-312.pyc b/migrations/versions/__pycache__/50f85881169e_.cpython-312.pyc new file mode 100644 index 0000000..aee53e0 Binary files /dev/null and b/migrations/versions/__pycache__/50f85881169e_.cpython-312.pyc differ diff --git a/migrations/versions/__pycache__/873defe09f22_.cpython-312.pyc b/migrations/versions/__pycache__/873defe09f22_.cpython-312.pyc index 32c9e19..fd851b5 100644 Binary files a/migrations/versions/__pycache__/873defe09f22_.cpython-312.pyc and b/migrations/versions/__pycache__/873defe09f22_.cpython-312.pyc differ diff --git a/migrations/versions/__pycache__/b24baa0d98e6_.cpython-312.pyc b/migrations/versions/__pycache__/b24baa0d98e6_.cpython-312.pyc new file mode 100644 index 0000000..69a74a0 Binary files /dev/null and b/migrations/versions/__pycache__/b24baa0d98e6_.cpython-312.pyc differ diff --git a/migrations/versions/__pycache__/b2a61aef79e9_.cpython-312.pyc b/migrations/versions/__pycache__/b2a61aef79e9_.cpython-312.pyc new file mode 100644 index 0000000..6f573f0 Binary files /dev/null and b/migrations/versions/__pycache__/b2a61aef79e9_.cpython-312.pyc differ diff --git a/migrations/versions/__pycache__/ec6bbcd361bd_.cpython-312.pyc b/migrations/versions/__pycache__/ec6bbcd361bd_.cpython-312.pyc index 90bb27f..1d027b0 100644 Binary files a/migrations/versions/__pycache__/ec6bbcd361bd_.cpython-312.pyc and b/migrations/versions/__pycache__/ec6bbcd361bd_.cpython-312.pyc differ diff --git a/static/js/modal.js b/static/js/modal.js new file mode 100644 index 0000000..e69de29 diff --git a/static/js/searchonaud.js b/static/js/searchonaud.js index 3a166a8..02a7001 100644 --- a/static/js/searchonaud.js +++ b/static/js/searchonaud.js @@ -24,21 +24,29 @@ var tr ="" data.forEach(element => { - + tr += '