示例#1
0
class Artist(db.Model):
    __tablename__ = 'Artist'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String, nullable=False)
    city = db.Column(db.String(120), nullable=False)
    state = db.Column(db.String(120), nullable=False)
    phone = db.Column(db.String(120), nullable=False)
    genres = db.Column(db.ARRAY(db.String), nullable=False)
    image_link = db.Column(db.String(500), nullable=False)
    website_link = db.Column(db.String(120))
    facebook_link = db.Column(db.String(120))
    seeking_venue = db.Column(db.Boolean, nullable=False, default=False)
    seeking_description = db.Column(db.String(), nullable=False)
    show = db.relationship('Show', backref='artist', lazy=True)
    def __repr__(self):
     return f'<Venue: {self.id} : {self.name}>'
示例#2
0
class Artist(db.Model):
    __tablename__ = 'Artist'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), nullable=False, unique=True)
    city = db.Column(db.String(120), nullable=False)
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String()))
    image_link = db.Column(db.String(500))
    facebook_link = db.Column(db.String(120))
    website_link = db.Column(db.String(200))
    seeking_venue = db.Column(db.Boolean, default=False)
    seeking_description = db.Column(db.String(200))

    def __repr__(self):
        return f'<Artist {self.id} {self.name}'
示例#3
0
class News(db.Model):
    __tablename__ = 'news'

    id = db.Column(db.Integer, primary_key=True)
    state = db.Column(db.String())
    county = db.Column(db.String())
    result = db.Column(db.JSON())
    keywords = db.Column(db.ARRAY(db.String()))

    def __init__(self, state, result, keywords):
        self.county = county
        self.state = state
        self.result = result
        self.keywords = keywords

    def __repr__(self):
        return '<id {}>'.format(self.id)
示例#4
0
class Venue(db.Model):
    __tablename__ = "Venue"

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    address = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    website = db.Column(db.String(120))
    image_link = db.Column(db.String(500))
    facebook_link = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String()))
    seeking_talent = db.Column(db.Boolean, default=False)
    seeking_description = db.Column(db.String)
    created_date = db.Column(db.DateTime)
    shows = db.relationship("Show", backref="venue", lazy=True)
示例#5
0
class Venue(db.Model):
    __tablename__ = 'Venue'
    __table_args__ = (db.UniqueConstraint('name', 'city'), )

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String, nullable=False)
    city = db.Column(db.String(120), nullable=False)
    state = db.Column(db.String(120), nullable=False)
    address = db.Column(db.String(120), nullable=False)
    phone = db.Column(db.String(120), nullable=False)
    image_link = db.Column(db.String(500), nullable=False, default='')
    facebook_link = db.Column(db.String(120), nullable=False, default='')
    genres = db.Column(db.ARRAY(db.Text), nullable=False)
    website = db.Column(db.String(120), nullable=False, default='')
    seeking_talent = db.Column(db.Boolean, nullable=False, default=False)
    seeking_description = db.Column(db.String, nullable=False, default='')
    shows=db.relationship('Show', backref='show_venue', cascade='all, delete, delete-orphan')
示例#6
0
class Venue(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    genres = db.Column(db.ARRAY(db.String()))
    address = db.Column(db.String(120))
    city = db.Column(db.String(120))
    state = 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(500))
    shows = db.relationship('Show', backref="venue", lazy=True)

    def __repr__(self):
        return '<Venue {}>'.format(self.name)
示例#7
0
class Artist(db.Model):
    __tablename__ = 'artist'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String())
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String()))
    image_link = db.Column(db.String(500))
    facebook_link = db.Column(db.String(120))
    website = db.Column(db.String(150))
    seeking_venue = db.Column(db.Boolean)
    seeking_description = db.Column(db.String(500))
    shows = db.relationship('Show', backref='artist', lazy=True)

    def __repr__(self):
        return f'<Artist {self.name}>'
示例#8
0
class Projects_objectstorages(Serializeable, db.Model):
    __tablename__ = 'engine_projects_objectstorages'
    __public__ = ['id', 'project', 'object_storage', 'channels']
    id = db.Column(db.Integer, primary_key=True)
    project_id = db.Column(db.Integer, db.ForeignKey('engine_projects.id'))
    object_storage_id = db.Column(db.Integer,
                                  db.ForeignKey('engine_objectstorages.id'))
    channels = db.Column(db.ARRAY(db.String(256)))

    project = db.relationship(
        'Projects',
        uselist=False,
        foreign_keys='Projects_objectstorages.project_id')
    object_storage = db.relationship(
        'Objectstorages',
        uselist=False,
        foreign_keys='Projects_objectstorages.object_storage_id')
示例#9
0
class Venue(db.Model):
    __tablename__ = 'Venue'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String, nullable=False)
    city = db.Column(db.String(120), nullable=False)
    state = db.Column(db.String(120), nullable=False)
    address = db.Column(db.String(120), nullable=False)
    phone = db.Column(db.String(120), nullable=False)
    image_link = db.Column(db.String(500), nullable=False)
    facebook_link = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(String), nullable=False)
    website = db.Column(db.String(120))
    facebook_link = db.Column(db.String(120))
    seeking_talent = db.Column(db.Boolean)
    seeking_description = db.Column(db.String(120))
    shows = db.relationship('Show', backref='venue', lazy=True)
示例#10
0
class Venue(db.Model):
    __tablename__ = 'Venue'

    # TODO: implement any missing fields, as a database migration using Flask-Migrate
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    genres = db.Column(db.ARRAY(db.String))
    address = db.Column(db.String(120))
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    website = db.Column(db.String(120))
    facebook_link = db.Column(db.String(120))
    seeking_talent = db.Column(db.Boolean, default=False)
    seeking_description = db.Column(db.String(500))
    image_link = db.Column(db.String(500))
    venue_shows = db.relationship('Show', backref='venue')
示例#11
0
class Artist(db.Model):
    __tablename__ = 'Artist'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String(120)))
    image_link = db.Column(db.String(500))
    website_link = db.Column(db.String(200))
    seeking_description = db.Column(db.String(200))
    facebook_link = db.Column(db.String(200))
    shows = db.relationship('Show', backref='artist', lazy=True)

    def __repr__(self):
        return f'<Artist ID:{self.id} ,Artist name:{self.name},Artist city:{self.city},Artist state:{self.state}, \
示例#12
0
class Employee(db.Model):
    id = db.Column(db.String(64), primary_key=True)
    name = db.Column(db.String(64), index=True)
    email = db.Column(db.String(120), index=True, unique=True)
    password_hash = db.Column(db.String(128))
    teams = db.Column(db.ARRAY(db.String), index=True)
    role = db.Column(db.String(64), db.ForeignKey('role.id'))
    claims = db.relationship(Claim, backref='claimant', lazy='dynamic')
    created_at = db.Column(db.DateTime, default=datetime.utcnow())
    updated_at = db.Column(db.DateTime, default=datetime.utcnow())

    def hash_password(self, password):
        self.password_hash = pwd_context.encrypt(password)

    def verify_password(self, password):
        return pwd_context.verify(password, self.password_hash)

    def generate_auth_token(self, expiration=600):
        s = Serializer(app.config['SECRET_KEY'], expires_in=expiration)
        return s.dumps({'id': self.id})

    @staticmethod
    def verify_auth_token(token):
        s = Serializer(app.config['SECRET_KEY'])
        try:
            data = s.loads(token)
        except SignatureExpired:
            return None  # valid token, but expired
        except BadSignature:
            return None  # invalid token
        employee = Employee.query.get(data['id'])
        return employee

    def __repr__(self):
        return '<Employee {}>'.format(self.name)

    @property
    def serialize(self):
        return {
            'id': self.id,
            'name': self.name,
            'email': self.email,
            'teams': self.teams,
            'role': self.role,
        }
示例#13
0
class Artist(db.Model):
    __tablename__ = 'Artist'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String()))
    image_link = db.Column(db.String(500))
    facebook_link = db.Column(db.String(120))
    seeking_venue = db.Column(db.Boolean, default=False)
    seeking_description = db.Column(db.String(700))
    website = db.Column(db.String(120))
    shows = db.relationship('Show', backref="artist", passive_deletes='all')

    def __repr__(self):
        return '<Artist {}, {}>'.format(self.name, self.city)
示例#14
0
class Venue(db.Model):
    __tablename__ = 'Venue'
# A venue can exist without a show or venuew
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String, nullable=False)
    city = db.Column(db.String(120), nullable=False)
    state = db.Column(db.String(120), nullable =False)
    address = db.Column(db.String(120), nullable=False)
    phone = db.Column(db.String(120),nullable=False)
    genres = db.Column(db.ARRAY(db.String), nullable=False)
    facebook_link = db.Column(db.String(120))
    image_link = db.Column(db.String(500), nullable=False)
    website_link= db.Column(db.String())
    seeking_talent = db.Column(db.Boolean, nullable=False, default=False)
    seeking_description = db.Column(db.String(), nullable=False)
    shows = db.relationship('Show', backref='Venue', lazy=True)
    def __repr__(self):
     return f'<Venue: {self.id} : {self.name}>'
示例#15
0
class Artist(db.Model):
    __tablename__ = 'Artist'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String(120)))
    image_link = db.Column(db.String(500))
    facebook_link = db.Column(db.String(120))
    website_link = db.Column(db.String(120))
    seeking_a_venue = db.Column(db.Boolean, default=False)
    seeking_venue_text = db.Column(db.String(500), nullable=True)
    shows = db.relationship('Show', backref='artist')

    def __repr__(self):
        return f'<Artist ID: {self.id}, Artist name: {self.name}>'
示例#16
0
class Artist(db.Model):
    __tablename__ = 'Artist'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String), nullable=False)
    image_link = db.Column(db.String(500))
    facebook_link = db.Column(db.String(120))
    website = db.Column(db.String(120))
    seeking_venue = db.Column(db.Boolean)
    seeking_description = db.Column(db.String)
    the_shows = db.relationship('Show', backref="artist", lazy=True)

    def __repr__(self):
        return '<Artist {}>'.format(self.name)
示例#17
0
class Venue(db.Model):
    __tablename__ = 'Venue'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    genres = db.Column(db.ARRAY(db.String))
    address = db.Column(db.String(120))
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    website = db.Column(db.String)
    facebook_link = db.Column(db.String(120))
    seeking_talent = db.Column(db.Boolean)
    seeking_description = db.Column(db.String)
    image_link = db.Column(db.String)

    def __repr__(self):
        return '<Venue %r>' % self.name
示例#18
0
class Anime(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(120))
    title_alt = db.Column(db.String(120))
    type = db.Column(db.String(80), nullable=False)
    start_date = db.Column(db.DateTime, nullable=False)
    end_date = db.Column(db.DateTime, nullable=False)
    season = db.Column(db.String(10), nullable=False)
    description = db.Column(db.Text, nullable=False)
    image_url = db.Column(db.String(200), nullable=False, default='Base Image')
    updated_at = db.Column(db.DateTime,
                           nullable=False,
                           default=datetime.utcnow)
    active = db.Column(db.Boolean, nullable=False, default=False)
    episodes = db.Column(db.ARRAY(db.Integer))

    def __repr__(self):
        return 'Anime {}, {}'.format(self.title, self.title_alt)
示例#19
0
class User(db.Model):
	__tablename__ = 'users'

	id = db.Column(db.Integer, primary_key=True)
	slack_userid = db.Column(db.String)
	slack_teamid = db.Column(db.String)
	slack_name = db.Column(db.String)
	current_slack_question = db.Column(db.String)
	slack_question_date_string = db.Column(db.String)
	slack_msg_cache = db.Column(db.ARRAY(db.String))

	@staticmethod
	def get_by_id(user_id):
		return User.query.filter_by(id=user_id).first()

	@staticmethod
	def get_by_slack_ids(slack_userid, slack_teamid):
		return User.query.filter_by(slack_userid=slack_userid, slack_teamid=slack_teamid).first()
示例#20
0
class Artist(db.Model):
    __tablename__ = 'artists'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String(120)))
    image_link = db.Column(db.String(500))
    facebook_link = db.Column(db.String(120))
    website = db.Column(db.String(120))
    seeking_venue = db.Column(db.Boolean(), default=False)
    seeking_description = db.Column(db.String)
    shows = db.relationship('Show',
                            backref='artist',
                            lazy='dynamic',
                            cascade='all, delete-orphan')
示例#21
0
class Venue(db.Model):
    __tablename__ = "Venue"

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    city = db.Column(db.String(120), index=True)
    state = db.Column(db.String(120), index=True)
    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))
    genres = db.Column(db.ARRAY(db.String()))
    seeking_talent = db.Column(db.Boolean(), default=False)
    seeking_description = db.Column(db.String())
    website_link = db.Column(db.String(500))
    artists = db.relationship("Artist", secondary=Shows,
                              backref=db.backref('Venue',
                                            cascade="all,delete"), lazy=True)
示例#22
0
class Artist(db.Model):
    __tablename__ = 'Artist'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String))
    image_link = db.Column(db.String(500))
    facebook_link = db.Column(db.String(120))
    website = db.Column(db.String(120))
    seeking_venue = db.Column(db.Boolean, default=False)
    seeking_description = db.Column(db.String(120))
    shows = db.relationship('Show', backref='Artist', lazy=True)

    def __repr__(self):
        return f'<Artist ID: {self.id}, name: {self.name}, city: {self.city}, state: {self.state}, phone: {self.phone}, image_link: {self.image_link}, facebook_link: {self.facebook_link}, genres: {self.genres}, website: {self.website}, seeking_venue: {self.seeking_venue}, seeking_description: {self.seeking_description}>'
class Artist(db.Model):
    __tablename__ = 'Artist'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    city = db.Column(db.String(120))
    state = 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))

    # implement any missing fields, as a database migration using Flask-Migrate
    website = db.Column(db.String(120))
    seeking_venue = db.Column(db.Boolean,
                              default=False,
                              server_default="false")
    seeking_venue_ad = db.Column(db.String(1000))
    genres = db.Column(db.ARRAY(db.String))
 def academic_difficulty_areas(cls):
     return db.Column(
         db.ARRAY(db.String),
         info={
             "display_order": 4,
             "type": "multicheckbox",
             "template_options": {
                 "type":
                 "array",
                 "label":
                 "Area of difficulty",
                 "required":
                 True,
                 "options": [
                     {
                         "value": "math",
                         "label": "Math"
                     },
                     {
                         "value": "reading",
                         "label": "Reading"
                     },
                     {
                         "value": "writing",
                         "label": "Writing"
                     },
                     {
                         "value": "other",
                         "label": "Other"
                     },
                 ],
             },
             "expression_properties": {
                 "template_options.description":
                 cls.academic_difficulty_areas_desc,
                 "template_options.required":
                 "model.has_academic_difficulties"
             },
             "hide_expression": "!(model.has_academic_difficulties)",
             "validators": {
                 "required": "multicheckbox"
             },
         },
     )
示例#25
0
文件: models.py 项目: lampoon2gn/core
class Sheet(db.Model):
    __tablename__ = 'sheet'

    sheet_label = db.Column(db.String(), primary_key=True)
    avgmoe = db.Column(db.DECIMAL())
    avgsg = db.Column(db.DECIMAL())
    avgmc = db.Column(db.DECIMAL())
    avgvel = db.Column(db.DECIMAL())
    avgupt = db.Column(db.DECIMAL())
    pkdensity = db.Column(db.DECIMAL())
    effvel = db.Column(db.ARRAY(db.DECIMAL()))
    lvel = db.Column(db.ARRAY(db.DECIMAL()))
    rvel = db.Column(db.ARRAY(db.DECIMAL()))
    lupt = db.Column(db.ARRAY(db.DECIMAL()))
    rupt = db.Column(db.ARRAY(db.DECIMAL()))
    sg = db.Column(db.ARRAY(db.DECIMAL()))
    mc = db.Column(db.ARRAY(db.DECIMAL()))
示例#26
0
class Venue(db.Model):
    __tablename__ = 'Venue'

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

    def __repr__(self):
        return f'Venue Name :{self.name}'
示例#27
0
class QuestionModel(db.Model):
    __tablename__ = 'questions'

    id = db.Column(db.Integer, primary_key=True)
    label = db.Column(db.String(55), nullable=False)
    survey_id = db.Column(db.Integer, db.ForeignKey('survey.id'))
    answer = db.Column(db.ARRAY(db.String))
    question_type = db.Column(db.String(25))
    actions = db.relationship('ActionModel',
                              backref='questions',
                              lazy='dynamic')

    def to_dict(self):
        return dict(id=self.id,
                    label=self.label,
                    answer=self.answer,
                    survey_id=self.survey_id,
                    question_type=self.question_type,
                    actions=[action.to_dict() for action in self.actions])
示例#28
0
class Venue(db.Model):
    __tablename__ = 'Venue'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    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))
    website_link = db.Column(db.String(120))
    facebook_link = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String(120)))
    seeking_a_talent = db.Column(db.Boolean, default=False)
    seeking_talent_text = db.Column(db.String(500), nullable=True)
    shows = db.relationship('Show', backref=backref('venue', uselist=False))

    def __repr__(self):
        return f'<Venue ID: {self.id}, Venue name: {self.name}>'
示例#29
0
class Artist(db.Model):
    """ Artist Model """
    __tablename__ = 'Artist'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    city = db.Column(db.String(120))
    state = db.Column(db.String(120))
    phone = db.Column(db.String(120))
    genres = db.Column(db.ARRAY(db.String()))
    website = db.Column(db.String(120))
    image_link = db.Column(db.String(500))
    facebook_link = db.Column(db.String(120))
    seeking_venue = db.Column(db.Boolean, nullable=False, default=False)
    seeking_description = db.Column(db.String(120))
    shows = db.relationship('Show', backref='artist', lazy=True)

    def __repr__(self):
        return 'Artist {}: {}'.format(self.id, self.name)
示例#30
0
class OAuth2Client(BaseModel, ClientMixin):
    __tablename__ = "oauth2_client"

    name = db.Column(db.String(255), nullable=False)
    secret = db.Column(db.String(120), nullable=False)
    redirect_uris = db.Column(db.ARRAY(db.String))

    @staticmethod
    def _generate_id():
        while True:
            id_ = int(str(uuid4().int)[:9])
            if OAuth2Client.query.get(id_) is None:
                return id_

    def get_client_id(self):
        return self.id

    def get_default_redirect_uri(self):
        redirect_uris = self.redirect_uris
        if redirect_uris:
            return redirect_uris[0]
        return None

    def get_allowed_scope(self, scope):
        return ""

    def check_redirect_uri(self, redirect_uri):
        return redirect_uri in self.redirect_uris

    def has_client_secret(self):
        return bool(self.secret)

    def check_client_secret(self, client_secret):
        return self.secret == client_secret

    def check_token_endpoint_auth_method(self, method):
        return True

    def check_response_type(self, response_type):
        return True

    def check_grant_type(self, grant_type):
        return grant_type == "authorization_code"