Changes to be committed:

new file:   .editorconfig
	deleted:    app.py
	deleted:    init_db.py
	deleted:    readme.md
	deleted:    requirements.txt
	deleted:    static/styles.css
	deleted:    templates/add.html
	deleted:    templates/edit.html
	deleted:    templates/index.html
This commit is contained in:
2025-06-29 16:22:49 +03:00
parent 1552ef2fbb
commit 1e9cc84c8a
9 changed files with 59 additions and 711 deletions

View File

@@ -1,25 +0,0 @@
import os
from app import db, app, Transaction
from datetime import date
app.app_context().push()
# Создание таблиц
db.create_all()
# Добавление начальных данных
if not Transaction.query.first():
transactions = [
Transaction(type='income', amount=50000, category='Зарплата', date=date(2023, 10, 15), description='Основная зарплата'),
Transaction(type='expense', amount=15000, category='Аренда', date=date(2023, 10, 5), description='Аренда квартиры'),
Transaction(type='expense', amount=3500, category='Продукты', date=date(2023, 10, 12), description='Супермаркет'),
Transaction(type='expense', amount=2500, category='Транспорт', date=date(2023, 10, 18), description='Бензин'),
Transaction(type='income', amount=10000, category='Фриланс', date=date(2023, 10, 20), description='Веб-разработка')
]
for t in transactions:
db.session.add(t)
db.session.commit()
print("База данных инициализирована с тестовыми данными")
else:
print("База данных уже содержит данные")