class Communes(db.Model): __tablename__ = 'communes' __table_args__ = {'schema': 'geopaysages'} code_commune = db.Column(db.String, primary_key=True, server_default=db.FetchedValue()) nom_commune = db.Column(db.String)
class DicoStheme(db.Model): __tablename__ = 'dico_stheme' __table_args__ = {'schema': 'geopaysages'} id_stheme = db.Column(db.Integer, primary_key=True, server_default=db.FetchedValue()) name_stheme = db.Column(db.String)
class DicoLicencePhoto(db.Model): __tablename__ = 'dico_licence_photo' __table_args__ = {'schema': 'geopaysages'} id_licence_photo = db.Column(db.Integer, primary_key=True, server_default=db.FetchedValue()) name_licence_photo = db.Column(db.String) description_licence_photo = db.Column(db.String)
class TPhoto(db.Model): __tablename__ = 't_photo' __table_args__ = {'schema': 'geopaysages'} id_photo = db.Column(db.Integer, primary_key=True, server_default=db.FetchedValue()) id_site = db.Column(db.ForeignKey('geopaysages.t_site.id_site')) path_file_photo = db.Column(db.String) id_role = db.Column(db.ForeignKey('utilisateurs.t_roles.id_role')) date_photo = db.Column(db.String) filter_date = db.Column(db.Date) legende_photo = db.Column(db.String) display_gal_photo = db.Column(db.Boolean) id_licence_photo = db.Column( db.ForeignKey('geopaysages.dico_licence_photo.id_licence_photo')) dico_licence_photo = db.relationship( 'DicoLicencePhoto', primaryjoin= 'TPhoto.id_licence_photo == DicoLicencePhoto.id_licence_photo', backref='t_photos') t_role = db.relationship('TRole', primaryjoin='TPhoto.id_role == TRole.id_role', backref='t_photos') t_site = db.relationship('TSite', primaryjoin='TPhoto.id_site == TSite.id_site', backref='t_photos')
class Doctors(db.Model): __tablename__ = 'doctors' id_doc = db.Column(db.Integer, primary_key=True) doc_name = db.Column(db.String(100), nullable=True) doc_spec = db.Column(db.String(100), nullable=True) doc_about = db.Column(db.Text, nullable=True) def save_to_db(self): db.session.add(self) db.session.commit() def __repr__(self): return '<Doctors %r>' % self.id_doc
class News(db.Model): __tablename__ = 'news' id_news = db.Column(db.Integer, primary_key=True) news_date = db.Column(db.Date, default=datetime.utcnow) news_title = db.Column(db.String(300), nullable=True) news_text = db.Column(db.Text, nullable=True) def save_to_db(self): try: db.session.add(self) db.session.commit() return ('ok') except: return ('error') def __repr__(self): return '<News %r>' % self.id_news
class Record(db.Model): __tablename__ = 'record' id_rec = db.Column(db.Integer, primary_key=True) rec_login = db.Column(db.String(100), nullable=True) rec_date = db.Column(db.Date, default=datetime.utcnow) rec_diag = db.Column(db.Text, nullable=True) def __init__(self, rec_login, rec_diag): self.rec_login = rec_login self.rec_diag = rec_diag def save_to_db(self): db.session.add(self) db.session.commit() def __repr__(self): return '<Record %r>' % self.id_rec
class User(db.Model, UserMixin): __tablename__ = 'sign_up' id_sign = db.Column(db.Integer, primary_key=True) sign_login = db.Column(db.String(100), nullable=True, unique=True) sign_password = db.Column(db.String(100), nullable=True) sign_role = db.Column(db.Integer, nullable=True) def save_to_db(self): if self.sign_login and self.sign_password and self.sign_role: db.session.add(self) db.session.commit() return ('ok') else: return ('error') def get_id(self): return (self.id_sign)
class CorSthemeTheme(db.Model): __tablename__ = 'cor_stheme_theme' __table_args__ = {'schema': 'geopaysages'} id_stheme_theme = db.Column(db.Integer, nullable=False, unique=True, server_default=db.FetchedValue()) id_stheme = db.Column(db.ForeignKey('geopaysages.dico_stheme.id_stheme'), primary_key=True, nullable=False) id_theme = db.Column(db.ForeignKey('geopaysages.dico_theme.id_theme'), primary_key=True, nullable=False) dico_stheme = db.relationship( 'DicoStheme', primaryjoin='CorSthemeTheme.id_stheme == DicoStheme.id_stheme', backref='cor_stheme_themes') dico_theme = db.relationship( 'DicoTheme', primaryjoin='CorSthemeTheme.id_theme == DicoTheme.id_theme', backref='cor_stheme_themes')
class CorSiteSthemeTheme(db.Model): __tablename__ = 'cor_site_stheme_theme' __table_args__ = {'schema': 'geopaysages'} id_site_stheme_theme = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) id_site = db.Column(db.ForeignKey('geopaysages.t_site.id_site'), primary_key=True, nullable=False) id_stheme_theme = db.Column( db.ForeignKey('geopaysages.cor_stheme_theme.id_stheme_theme'), primary_key=True, nullable=False) t_site = db.relationship( 'TSite', primaryjoin='CorSiteSthemeTheme.id_site == TSite.id_site', backref='cor_site_stheme_themes') cor_stheme_theme = db.relationship( 'CorSthemeTheme', primaryjoin= 'CorSiteSthemeTheme.id_stheme_theme == CorSthemeTheme.id_stheme_theme', backref='cor_site_stheme_themes')
class TSite(db.Model): __tablename__ = 't_site' __table_args__ = {'schema': 'geopaysages'} id_site = db.Column(db.Integer, primary_key=True, server_default=db.FetchedValue()) name_site = db.Column(db.String) ref_site = db.Column(db.String) desc_site = db.Column(db.String) legend_site = db.Column(db.String) testim_site = db.Column(db.String) code_city_site = db.Column(db.String) alti_site = db.Column(db.Integer) path_file_guide_site = db.Column(db.String) publish_site = db.Column(db.Boolean) geom = db.Column(Geometry(geometry_type='POINT', srid=4326)) main_photo = db.Column(db.Integer)
class Ville(db.Model): __tablename__ = 'villes_france' __table_args__ = {'schema': 'geopaysages'} ville_id = db.Column(db.Integer, primary_key=True, server_default=db.FetchedValue()) ville_departement = db.Column(db.String) ville_slug = db.Column(db.String) ville_nom = db.Column(db.String) ville_nom_simple = db.Column(db.String) ville_nom_reel = db.Column(db.String) ville_nom_soundex = db.Column(db.String) ville_nom_metaphone = db.Column(db.String) ville_code_postal = db.Column(db.String) ville_commune = db.Column(db.String) ville_code_commune = db.Column(db.String) ville_arrondissement = db.Column(db.Integer) ville_canton = db.Column(db.String) ville_amdi = db.Column(db.Integer) ville_population_2010 = db.Column(db.Integer) ville_population_1999 = db.Column(db.Integer) ville_population_2012 = db.Column(db.Integer) ville_densite_2010 = db.Column(db.Integer) ville_surface = db.Column(db.Integer) ville_longitude_deg = db.Column(db.Integer) ville_latitude_deg = db.Column(db.Integer) ville_longitude_grd = db.Column(db.String) ville_latitude_grd = db.Column(db.String) ville_latitude_dms = db.Column(db.String) ville_zmin = db.Column(db.Integer) ville_zmax = db.Column(db.Integer)
class TRole(db.Model): __tablename__ = 't_roles' __table_args__ = {'schema': 'utilisateurs', 'extend_existing': True} groupe = db.Column(db.Boolean, nullable=False, server_default=db.FetchedValue()) id_role = db.Column(db.Integer, primary_key=True, server_default=db.FetchedValue()) identifiant = db.Column(db.String(100)) nom_role = db.Column(db.String(50)) prenom_role = db.Column(db.String(50)) desc_role = db.Column(db.Text) _pass = db.Column('pass', db.String(100)) _pass_plus = db.Column('pass_plus', db.String(100)) email = db.Column(db.String(250)) id_organisme = db.Column( db.ForeignKey('utilisateurs.bib_organismes.id_organisme', onupdate='CASCADE')) remarques = db.Column(db.Text) date_insert = db.Column(db.DateTime) date_update = db.Column(db.DateTime)