poprwka sql
This commit is contained in:
11
app.py
11
app.py
@@ -498,7 +498,6 @@ def formularz_zbiorek(zbiorka_id=None):
|
|||||||
zb.nazwa = nazwa
|
zb.nazwa = nazwa
|
||||||
zb.opis = opis
|
zb.opis = opis
|
||||||
|
|
||||||
# NOT NULL-safe: puste stringi gdy wyłączone
|
|
||||||
zb.uzyj_konta = uzyj_konta
|
zb.uzyj_konta = uzyj_konta
|
||||||
zb.uzyj_blik = uzyj_blik
|
zb.uzyj_blik = uzyj_blik
|
||||||
zb.numer_konta = numer_konta if uzyj_konta else ""
|
zb.numer_konta = numer_konta if uzyj_konta else ""
|
||||||
@@ -510,8 +509,11 @@ def formularz_zbiorek(zbiorka_id=None):
|
|||||||
zb.pokaz_postep_pozycje = pokaz_postep_pozycje
|
zb.pokaz_postep_pozycje = pokaz_postep_pozycje
|
||||||
zb.pokaz_postep_kwotowo = pokaz_postep_kwotowo
|
zb.pokaz_postep_kwotowo = pokaz_postep_kwotowo
|
||||||
|
|
||||||
zb.przedmioty.clear()
|
db.session.commit()
|
||||||
db.session.flush()
|
|
||||||
|
db.session.execute(
|
||||||
|
Przedmiot.__table__.delete().where(Przedmiot.zbiorka_id == zb.id)
|
||||||
|
)
|
||||||
|
|
||||||
for i, raw_name in enumerate(names):
|
for i, raw_name in enumerate(names):
|
||||||
name = (raw_name or "").strip()
|
name = (raw_name or "").strip()
|
||||||
@@ -547,7 +549,7 @@ def formularz_zbiorek(zbiorka_id=None):
|
|||||||
pokaz_postep_kwotowo=pokaz_postep_kwotowo,
|
pokaz_postep_kwotowo=pokaz_postep_kwotowo,
|
||||||
)
|
)
|
||||||
db.session.add(nowa)
|
db.session.add(nowa)
|
||||||
db.session.commit() # potrzebne ID
|
db.session.commit()
|
||||||
|
|
||||||
for i, raw_name in enumerate(names):
|
for i, raw_name in enumerate(names):
|
||||||
name = (raw_name or "").strip()
|
name = (raw_name or "").strip()
|
||||||
@@ -570,6 +572,7 @@ def formularz_zbiorek(zbiorka_id=None):
|
|||||||
|
|
||||||
return redirect(url_for("admin_dashboard"))
|
return redirect(url_for("admin_dashboard"))
|
||||||
|
|
||||||
|
|
||||||
# GET
|
# GET
|
||||||
return render_template(
|
return render_template(
|
||||||
"admin/formularz_zbiorek.html",
|
"admin/formularz_zbiorek.html",
|
||||||
|
|||||||
Reference in New Issue
Block a user