Beispiel #1
0
class FieldEvent(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    location = db.Column(db.String(100))
    date_start = db.Column(db.Date)
    date_end_expected = db.Column(db.Date)
    date_end_done = db.Column(db.Date)
    observations = db.Column(db.Text)
    personnel = db.relationship("Person", secondary=lambda: helper_field_person, back_populates="field_events")
    equipments = db.relationship("Inventory", secondary=lambda: helper_field_equips, back_populates="field_events")
Beispiel #2
0
class Inventory(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), nullable=False)
    description = db.Column(db.Text)
    imagefile = db.Column(db.String(20), default='default.jpg')
    imagefile_path = db.Column(db.String, default=os.path.join("static/equip_pics", "default.jpg"))
    lendings = db.relationship('Lendings', backref='equipment', lazy=True)
    issues = db.relationship('TechnicalIssues', backref='equipment', lazy=True)
    field_events = db.relationship("FieldEvent", secondary=lambda: helper_field_equips, back_populates="equipments")
Beispiel #3
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(20), unique=True, nullable=False)
    email = db.Column(db.String(120), unique=True, nullable=False)
    password = db.Column(db.String(60), nullable=False)
    person_id = db.Column(db.Integer, db.ForeignKey(Person.id))
    notices = db.relationship('Notices', backref='author', lazy=True)
Beispiel #4
0
class Person(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    first_name = db.Column(db.String(50))
    last_name = db.Column(db.String(50))
    middle_name = db.Column(db.String(100))
    phone = db.Column(db.String(20))
    birthday = db.Column(db.Date)
    occupation = db.Column(db.Text)
    institution = db.Column(db.String(100))
    imagefile = db.Column(db.String(20), nullable=False, default='default.jpg')
    imagefile_path = db.Column(db.String, nullable=False, default=os.path.join("static/profile_pics", "default.jpg"))
    type_id = db.Column(db.Integer, db.ForeignKey(PersonType.id))
    genre_id = db.Column(db.Integer, db.ForeignKey(Genre.id))
    account = db.relationship('User', backref='own_info', lazy=True)
    frequency = db.relationship('FrequencyEvent', backref='person_frequency', lazy=True)
    field_events = db.relationship("FieldEvent", secondary=lambda: helper_field_person, back_populates="personnel")
Beispiel #5
0
class Genre(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    genre_name = db.Column(db.String)
    person = db.relationship('Person', backref='person_genre', lazy=True)
Beispiel #6
0
class PersonType(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    type_name = db.Column(db.String)
    person = db.relationship('Person', backref='person_type', lazy="joined")