class CureSchema(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(64), index=True, unique=True, info={'label': u'Наименование'}) descr = db.Column(db.String(65000), info={'label': u'Диагностика'}) cure = db.Column(db.String(65000), info={'label': u'Лечение'}) def __repr__(self): return self.title
class Medicine(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(64), index=True, unique=True, info={'label': u'Наименование'}) descr = db.Column(db.String(65000), info={'label': u'Описание'}) active_amount = db.Column( db.Float, info={'label': u'Количество действующего вещества (мг/мл)'}) active_substance_id = db.Column(db.Integer, db.ForeignKey('active_substance.id')) active_substance = db.relationship('ActiveSubstance', backref=db.backref('medicines', lazy='dynamic'), info={'label': u'Активное вещество'}) def __repr__(self): return self.title
class Dosage(db.Model): id = db.Column(db.Integer, primary_key=True) animal_type_id = db.Column(db.Integer, db.ForeignKey('animal_type.id')) animal_type = db.relationship('AnimalType', backref=db.backref('animal_types', lazy='dynamic'), info={'label': u'Вид животного'}) active_substance_id = db.Column(db.Integer, db.ForeignKey('active_substance.id')) active_substance = db.relationship('ActiveSubstance', backref=db.backref('active_substances', lazy='dynamic'), info={'label': u'Дейсвующее вещество'}) value = db.Column(db.Float, info={'label': u'от'}) value_max = db.Column(db.Float, info={'label': u'до'}) def __repr__(self): return u'<Дозировка для {0}:от {1} до {2}>'.format( self.animal_type, self.value, self.value_max)
class User(db.Model): id = db.Column(db.Integer, primary_key=True) nickname = db.Column(db.String(64), index=True, unique=True) email = db.Column(db.String(120), index=True, unique=True) role = db.Column(db.SmallInteger, default=ROLE_USER) # posts = db.relationship('Post', backref='author', lazy='dynamic') about_me = db.Column(db.String(140)) last_seen = db.Column(db.DateTime) def __repr__(self): return '<User %r>' % (self.nickname) def is_active(self): return True def get_id(self): return unicode(self.id) def is_authenticated(self): return True def is_anonimus(self): return False @lm.user_loader def load_user(id): return User.query.get(int(id))
class Audit(db.Model): id = db.Column(db.Integer, primary_key=True) table_name = db.Column(db.String(64), index=True) object_id = db.Column(db.Integer, index=True) descr = db.Column(db.String(1024))
class ActiveSubstance(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), info={'label': u'Наименование'}) def __repr__(self): return u'{0}'.format(self.name)
class Unit(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), index=True, unique=True) def __repr__(self): return self.name
class AnimalType(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), info={'label': u'Вид животного'}) def __repr__(self): return u'{0}'.format(self.name)