class Venue(db.Model, BaseMixin): """ Venue database since we'll want to reuse that. """ __tablename__ = 'venue' #: Name of the venue name = db.Column(db.Unicode(80), nullable=False) #: Display name of the venue title = db.Column(db.Unicode(80), nullable=False) #: Description for the venue description = db.Column(db.Text) #: Address of the venue address = db.Column(db.Text, nullable=True) #: Latitude of the venue lat = db.Column(db.Float(10)) #: Longitude of the venue lng = db.Column(db.Float(10)) #: Events associated with the venue events = db.relationship('Event', backref='venue', lazy='dynamic') #: City of the venue city_id = db.Column(db.Integer, db.ForeignKey('city.id')) def __repr__(self): return self.title
class Event(db.Model, BaseMixin): """ Events - the core of geekup """ __tablename__ = 'event' #: Name of the event name = db.Column(db.Unicode(80), nullable=False) #: Title of the event title = db.Column(db.Unicode(80), nullable=False) #: Year of the event year = db.Column(db.Integer, default=date.today().year, nullable=False) #: Date of the event date = db.Column(db.Date, nullable=False) #: Description for the event description = db.Column(db.Text, nullable=False) #: Speaker name speaker = db.Column(db.Unicode(255), nullable=False) #: Speaker Bio customized for the event speaker_bio = db.Column(db.Text, nullable=False) #: Schedule JSON for the event. schedule_data = db.Column(db.Text, nullable=False) #: Photo of the speaker photo = db.Column(db.Unicode(255), nullable=True) #: Statu of the event: #: True = Open #: False = Closed status = db.Column(db.Boolean, default=True, nullable=False) #: Venue for the event, event.venue will give access to the #: event's venue object venue_id = db.Column(db.Integer, db.ForeignKey('venue.id')) #: User creating the event, event.user will give access to #: the user's object user_id = db.Column(db.Integer, db.ForeignKey('user.id')) #: City for the event, event.city will give access to the #: city's object. city_id = db.Column(db.Integer, db.ForeignKey('city.id')) #: List of speakers for the event, event.speakers gives access #: to the objects speakers = db.relationship('Speaker', secondary=event_speaker, backref=db.backref('events', lazy='dynamic')) #: List of sponsors for the event, event.sponsors gives access #: to the objects sponsors = db.relationship('Sponsor', secondary=event_sponsor, backref=db.backref('events', lazy='dynamic')) #: List of participants, event.participants gives access to #: the objects participants = db.relationship('Participant', backref='event', lazy='dynamic') def __repr__(self): return self.title
class Speaker(db.Model, BaseMixin): """ Speaker data to display on event pages """ __tablename__ = 'speaker' #: Name of the speaker name = db.Column(db.Unicode(80), nullable=False) #: Display name of the speaker title = db.Column(db.Unicode(80), nullable=False) #: Photo of the speaker photo = db.Column(db.Unicode(255), nullable=True) #: Generic bio for the speaker description = db.Column(db.Text, nullable=True) def __repr__(self): return self.title
class Sponsor(db.Model, BaseMixin): """ Sponsor data to display on event pages """ __tablename__ = 'sponsor' #: Name of the sponsor name = db.Column(db.Unicode(80), nullable=False) #: Title of the sponsor title = db.Column(db.Unicode(80), nullable=False) #: Sponsor's logo photo = db.Column(db.Unicode(255), nullable=True) #: URL to the sponsor's website url = db.Column(db.Unicode(255), nullable=True) #: Description of sponsor description = db.Column(db.Text, nullable=True) def __repr__(self): return self.title
class Participant(db.Model, BaseMixin): """ Participant data, as submitted from the registration form. """ __tablename__ = 'participant' #: User's full name fullname = db.Column(db.Unicode(80), nullable=False) #: User's email address email = db.Column(db.Unicode(80), nullable=False) #: User's company name company = db.Column(db.Unicode(80), nullable=False) #: User's job title jobtitle = db.Column(db.Unicode(80), nullable=False) #: User's twitter id (optional) twitter = db.Column(db.Unicode(80), nullable=True) #: How did the user hear about this event? referrer = db.Column(db.Integer, nullable=False, default=0) #: User category, defined by a reviewer category = db.Column(db.Integer, nullable=False, default=0) #: User agent with which the user registered useragent = db.Column(db.Unicode(250), nullable=True) #: Date the user registered regdate = db.Column(db.DateTime, default=datetime.utcnow, nullable=False) #: Submitter's IP address, for logging #: (45 chars to accommodate an IPv6 address) ipaddr = db.Column(db.Text(45), nullable=False) #: Has the user's application been approved? approved = db.Column(db.Boolean, default=False, nullable=False) #: RSVP status codes: #: 0 = Awaiting Response #: 1 = Yes, Attending #: 2 = Maybe Attending #: 3 = Not Attending rsvp = db.Column(db.Integer, default=0, nullable=False) #: Did the participant attend the event? attended = db.Column(db.Boolean, default=False, nullable=False) #: Datetime the participant showed up attenddate = db.Column(db.DateTime, nullable=True) #: Have we sent this user an email email_sent = db.Column(db.Boolean, default=False, nullable=False) #: Key created with coaster.secretkey email_key = db.Column(db.Unicode(44), nullable=True) #: Is it confirmed or not email_status = db.Column(db.Boolean, default=False, nullable=False) #: Event they'd like to attend event_id = db.Column(db.Integer, db.ForeignKey('event.id')) def __repr__(self): return self.fullname