Example #1
0
class Platform(db.Model, DictSerializable):
    __tablename__ = 'platform'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(120), unique=True)

    def __init__(self, name):
        self.name = name

    def __repr__(self):
        return '<name %r>' % self.name
Example #2
0
class Event(db.Model, DictSerializable):
    __tablename__ = 'event'
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(500), unique=False)
    icon = db.Column(db.String(200), unique=False)
    dtstart = db.Column(db.DateTime(), unique=False)
    dtend = db.Column(db.DateTime(), unique=False)
    location = db.Column(db.String(100), unique=False)
    description = db.Column(db.String(1500), unique=False)
    fb_event = db.Column(db.String(20), unique=False)
    map_query = db.Column(db.String(100), unique=False)

    def __init__(self, title, icon, dtstart, dtend, location, description,
                 fb_event, map_query):
        self.title = title
        self.icon = icon
        self.dtstart = dtstart
        self.dtend = dtend
        self.location = location
        self.description = description
        self.fb_event = fb_event
        self.map_query = map_query

    def __repr__(self):
        return '<Event %r>' % self.id
Example #3
0
class Technology(db.Model, DictSerializable):
    __tablename__ = 'technology'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(120), unique=True)
    website = db.Column(db.String(120), unique=True)

    def __init__(self, name, website):
        self.name = name
        self.website = website

    def __repr__(self):
        return '<name %r>' % self.name
Example #4
0
class Project(db.Model, DictSerializable):
    __tablename__ = 'project'
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(120), unique=True)
    author = db.Column(db.String(120), unique=False)
    contact = db.Column(db.String(120), unique=False)
    website = db.Column(db.String(120), unique=False)
    description = db.Column(db.String(1000), unique=False)
    icon = db.Column(db.String(100), unique=False)

    technologies = db.relationship('Technology',
                                   secondary=pro_tech,
                                   backref=db.backref('projects',
                                                      lazy='dynamic'))

    def __init__(self, title, author, contact, website, description, icon):
        self.title = title
        self.author = author
        self.contact = contact
        self.website = website
        self.description = description
        self.icon = icon

    def __repr__(self):
        return '<name %r>' % self.title
Example #5
0
class Group(db.Model, DictSerializable):
    __tablename__ = 'group_'
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(120), unique=True)
    host = db.Column(db.String(120), unique=False)
    contact = db.Column(db.String(120), unique=False)
    meetings = db.Column(db.String(200), unique=False)
    location = db.Column(db.String(200), unique=False)
    fb_group = db.Column(db.String(300), unique=False)
    description = db.Column(db.String(1000), unique=False)
    icon = db.Column(db.String(120), unique=False)

    def __init__(self, title, host, contact, meetings, description, icon):
        self.title = title
        self.host = host
        self.contact = contact
        self.meetings = meetings
        self.description = description
        self.icon = icon

    def __repr__(self):
        return '<name %r>' % self.title
Example #6
0
class Challenge(db.Model, DictSerializable):
    __tablename__ = 'challenge'
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), unique=False)
    short_desc = db.Column(db.String(300), unique=False)
    long_desc = db.Column(db.String(1500), unique=False)
    icon = db.Column(db.String(100), unique=False)
    repo = db.Column(db.String(100), unique=False)
    website = db.Column(db.String(100), unique=False)
    teams = relationship("Team", backref="challenge")

    def __init__(self, title, short_desc, long_desc, icon, repo, website):
        self.title = title
        self.short_desc = short_desc
        self.long_desc = long_desc
        self.icon = icon
        self.repo = repo
        self.website = website
Example #7
0
class Member(db.Model, DictSerializable):
    __tablename__ = 'member'
    id = db.Column(db.Integer, primary_key=True)
    fullname = db.Column(db.String(120), unique=False)
    email = db.Column(db.String(120), unique=True)
    gumail = db.Column(db.Boolean, unique=False)
    sub_meetings = db.Column(db.Boolean, unique=False, default=True)
    sub_hackathon = db.Column(db.Boolean, unique=False, default=True)
    write_key = db.Column(db.String(80), unique=False)

    events = db.relationship('Event',
                             secondary=memb_event,
                             backref=db.backref('members', lazy='dynamic'))

    def __init__(self, fullname, email, gumail):
        self.fullname = fullname
        self.email = email
        self.gumail = gumail
        self.write_key = hashlib.sha1(email + HASH_SALT).hexdigest()

    def __repr__(self):
        return '<Email %r>' % self.email
Example #8
0
class HackathonNotify(db.Model, DictSerializable):
    __tablename__ = 'hackathon_notify'
    id = db.Column(db.Integer, primary_key=True)
    fullname = db.Column(db.String(120), unique=False)
    email = db.Column(db.String(120), unique=True)
Example #9
0
class Participant(db.Model, DictSerializable):
    __tablename__ = 'participant'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), unique=False)
    challenge_id = Column(Integer, ForeignKey('team.id'))
Example #10
0
class Team(db.Model, DictSerializable):
    __tablename__ = 'team'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), unique=False)
    challenge_id = Column(Integer, ForeignKey('challenge.id'))
    participants = relationship("Participant", backref="team")
Example #11
0
        if value is None:
            return None
        return [value.strftime("%Y-%m-%d %H:%M:%S")]

    def _asdict(self):
        result = OrderedDict()
        for key in self.__mapper__.c.keys():
            if (key == "dtstart" or key == "dtend"):
                result[key] = self.dump_datetime(getattr(self, key))
            else:
                result[key] = getattr(self, key)
        return result


memb_event = db.Table(
    'memb_event', db.Column('member_id', db.Integer,
                            db.ForeignKey('member.id')),
    db.Column('event_id', db.Integer, db.ForeignKey('event.id')))


class Member(db.Model, DictSerializable):
    __tablename__ = 'member'
    id = db.Column(db.Integer, primary_key=True)
    fullname = db.Column(db.String(120), unique=False)
    email = db.Column(db.String(120), unique=True)
    gumail = db.Column(db.Boolean, unique=False)
    sub_meetings = db.Column(db.Boolean, unique=False, default=True)
    sub_hackathon = db.Column(db.Boolean, unique=False, default=True)
    write_key = db.Column(db.String(80), unique=False)

    events = db.relationship('Event',
                             secondary=memb_event,