예제 #1
0
class User(Generic):
    id=db.Column("user_id",db.Integer(),primary_key=True)
    name = db.Column("user_name", db.String(100))
    age = db.Column("user_age", db.Integer())
    email = db.Column("user_email", db.String(100), unique=True)
    password= db.Column("user_password", db.String(100), unique=True)
    loginrefs = db.relationship('Login',uselist=False,backref="userref",lazy=True)
예제 #2
0
파일: models.py 프로젝트: pavponn/fyyur
class Show(db.Model):
    __tablename__ = 'shows'

    id = db.Column(db.Integer, primary_key=True)
    artist_id = db.Column(db.Integer, db.ForeignKey('artists.id'), nullable=False)
    venue_id = db.Column(db.Integer, db.ForeignKey('venues.id'), nullable=False)
    start_time = db.Column(db.DateTime, nullable=False)

    def __repr__(self):
        return f'<Show artist:{self.artist_id} venue:{self.venue_id}>'
예제 #3
0
class Club(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    nombre = db.Column(db.String(96))
    direccion = db.Column(db.String(64))
    email = db.Column(db.String(64))
    actividades = db.Column(db.Text)
    instalaciones = db.Column(db.Text)
    telefono = db.Column(db.String(24))
    web = db.Column(db.String(32))
    barrio = db.Column(db.String(32))
    pos_x = db.Column(db.Float)
    pos_y = db.Column(db.Float)

    def save(self):
        db.session.add(self)
        db.session.commit()

    def __init__(self, nombre, direccion, email, actividades, instalaciones, telefono, web, barrio, pos_x, pos_y):
        self.nombre = nombre
        self.direccion = direccion
        self.email = email
        self.actividades = actividades
        self.instalaciones = instalaciones
        self.telefono = telefono
        self.web = web
        self.barrio = barrio
        self.pos_x = pos_x
        self.pos_y = pos_y
예제 #4
0
class Generic(db.Model):
    __abstract__ = True
    active = db.Column('active', db.String(10), default='Y')
    created = db.Column("created", db.DateTime, default=db.func.current_timestamp())
    modified = db.Column("modified", db.DateTime, default=db.func.current_timestamp(),onupdate=db.func.current_timestamp())
예제 #5
0
class Login(Generic):
    id = db.Column("id", db.Integer(), primary_key=True)
    email = db.Column("email", db.String(100), unique=True)
    password = db.Column("password", db.String(100), unique=True)
    userid = db.Column('user_id', db.ForeignKey('user.user_id'), unique=False, nullable=True)
예제 #6
0
파일: models.py 프로젝트: pavponn/fyyur
class Venue(db.Model):
    __tablename__ = 'venues'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), nullable=False)
    genres = db.Column(db.ARRAY(db.String(30)))
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    address = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    image_link = db.Column(db.String(500))
    facebook_link = db.Column(db.String(120))
    website = db.Column(db.String(120))
    seeking_talent = db.Column(db.Boolean)
    seeking_description = db.Column(db.String(250))
    shows = db.relationship('Show', backref='venue', lazy=True)

    def __repr__(self):
        return f'<Venue {self.id} {self.name}>'