accountant/api/model/scheduled_operations.py
Alexis Lahouze cb8bf24bad Fix lazy.
2015-06-05 18:07:21 +02:00

31 lines
1.1 KiB
Python

from . import db
from .accounts import Account
from sqlalchemy import func, desc
from sqlalchemy.orm import column_property
from sqlalchemy.sql import func, select
class ScheduledOperation(db.Model):
id = db.Column(db.Integer, primary_key=True)
start_date = db.Column(db.Date, nullable = False)
stop_date = db.Column(db.Date, nullable = False)
day = db.Column(db.Integer, nullable = False)
frequency = db.Column(db.Integer, nullable = False)
label = db.Column(db.String(500), nullable = False)
value = db.Column(db.Numeric(15, 2), nullable = False)
account_id = db.Column(db.Integer, db.ForeignKey('account.id'))
account = db.relationship(Account, backref = db.backref('scheduled_operation', lazy="dynamic"))
category = db.Column(db.String(100), nullable = True)
def __init__(self, start_date, stop_date, day, frequency, label, value, account_id, category = None):
self.start_date = start_date
self.stop_date = stop_date
self.day = day
self.frequency = frequency
self.label = label
self.value = value
self.account_id = account_id
self.category = category