class Guest(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80), nullable=False) email = db.Column(db.String(80), nullable=False) phone = db.Column(db.String(80), nullable=False) events_attending = db.relationship('Event', secondary="guest_event", back_populates="guest")
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80), unique=True, nullable=False) description = db.Column(db.String(120), unique=False, nullable=False) date_and_time = db.Column(db.DateTime(),) guests = db.relationship( 'Guest', secondary='guest_event', back_populates='events_attending')
class User(UserMixin, db.Model): """ Define User class for Flask-Login. We also use this to persist our users in our database. """ id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(40), nullable=False) username = db.Column(db.String(40), nullable=False) email = db.Column(db.String(30), nullable=False) password = db.Column(db.String(120), nullable=True) is_admin = db.Column(db.Boolean, default=False) def set_is_admin(self): """Set is_admin to true under certain circumstances.""" if self.email == "*****@*****.**": self.is_admin = True def set_password(self, password): """Return new user from User class.""" self.password = sha256_crypt.hash(password) def check_password(self, password): """Verify hashed password and inputted password.""" return sha256_crypt.verify(password, self.password)
class Guest(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) phone = db.Column(db.Integer, unique=True, nullable=False) events_attending = db.relationship( 'Event', secondary="guest_event", back_populates='guests') # used back_populates prior to backref
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) description = db.Column(db.String(200), nullable=False) date_and_time = db.Column(db.DateTime, nullable=False) guests = db.relationship("Guest", secondary="guest_event", back_populates="events_attending")
class Guest(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), nullable=False) email = db.Column(db.String(100), nullable=False, unique=True) phone = db.Column(db.String(10), nullable=True, unique=True) events_attending = db.relationship('Event', secondary='table_guest_event', back_populates='guests')
class Guest(db.Model): """Guest model.""" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80), nullable=False) email = db.Column(db.String(100), nullable=False) phone = db.Column(db.String(20), nullable=False) events_attending = db.relationship("Event", secondary="guest_event_table", back_populates="guests")
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80), nullable=False) description = db.Column(db.String(80), nullable=False) date_and_time = db.Column(db.Date) guest = db.relationship('Guest', secondary="guest_event", back_populates="events_attending") event_type = db.Column(db.Enum(EventType), default=EventType.GENERAL)
class Guest(db.Model): """Guest model.""" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80)) email = db.Column(db.String(80)) phone = db.Column(db.String(20)) events = db.relationship('Event', secondary='guest_event', back_populates='guests')
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(30), nullable=False) description = db.Column(db.String(100), nullable=False) date_and_time = db.Column(db.DateTime) guests = db.relationship('Guest', secondary='guest_event_table', back_populates='events_attending') event_type = db.Column(db.Enum(Event_TYPE))
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) # TODO: Create a table `guest_event_table` with the following columns: # - event_id: Integer column (foreign key) # - guest_id: Integer column (foreign key) title = db.Column(db.String(50), nullable=False) description = db.Column(db.String(100)) date_and_time = db.Column(db.Date) guests = db.relationship('Guest', secondary='guest_event', back_populates='events_attending')
class Event(db.Model): """Event Model""" id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80), nullable=False) description = db.Column(db.String(80), nullable=False) date_and_time = db.Column( db.DateTime, nullable=False) event_type = db.Column(db.Enum(Type), default=Type.ALL) guests = db.relationship( 'Guest', secondary='guest_event', back_populates='events_attending')
class Event(db.Model): """Event model.""" id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80)) description = db.Column(db.String(80)) date_and_time = db.Column(db.DateTime) event_type = db.Column(db.Enum(Event_Type), default=Event_Type.OTHER) guests = db.relationship('Guest', secondary='guest_event', back_populates='events')
class Event(db.Model): __tablename__ = 'events' id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80)) description = db.Column(db.String(80)) date_and_time = db.DateTime(db.DateTime()) event_type = db.Column(db.Enum(EVENT_TYPE)) guests = db.relationship('Guest', back_populates="events_attending", secondary='guest_event_table')
class Guest(db.Model): #SQL Error?? __tablename__ = 'guests' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80)) email = db.Column(db.String(80)) phone = db.Column(db.String(80)) events_attending = db.relationship('Event', back_populates="guests", secondary='guest_event_table')
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80), nullable=False) description = db.Column(db.String(80), nullable=False) date_and_time = db.Column(db.DateTime, nullable=False, default=datetime.strftime( datetime.today(), "%b %d %Y")) guests = db.relationship('Guest', secondary='guest_event_table', back_populates='events_attending')
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80), nullable=False) description = db.Column(db.String(80)) date_and_time = db.Column(db.Date) guests = db.relationship('Guest', secondary='guest_event') def __str__(self): return f'<Event Title: {self.title}>' def __repr__(self): return f'<Event Title: {self.title}>'
class Guest(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80), nullable=False) email = db.Column(db.String(80)) phone = db.Column(db.String(80)) genres = db.relationship('Event', secondary='guest_event') def __str__(self): return f'<Name:{self.name}' def __repr__(self): return f'<Name:{self.name}'
class Guest(db.Model): id = db.Column(db.Integer, primary_key=True) # TODO: Create a model called `Event` with the following fields: # - id: primary key # - title: String column # - description: String column # - date_and_time: DateTime column # - guests: relationship to "Guest" table with a secondary table name = db.Column(db.String(80), nullable = False) email = db.Column(db.String(80), nullable = False) phone = db.Column(db.String(80), nullable = False) events_attending = db.relationship('Event', secondary = 'guest_event', back_populates = 'guests')
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) # TODO: Create a table `guest_event_table` with the following columns: # - event_id: Integer column (foreign key) # - guest_id: Integer column (foreign key) title = db.Column(db.String(80), nullable=False) description = db.Column(db.String(140)) date_and_time = db.Column(db.DateTime) event_type = db.Column(db.Enum(Type), default=Type.ALL) guests = db.relationship("Guest", secondary="guest_event", back_populates="events_attending")
class Guest(db.Model): """Create Guest model.""" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(55), nullable=False) email = db.Column(db.String(40), nullable=False) plus_one = db.Column(db.String(55), nullable=True) phone = db.Column(db.String(12), nullable=False) events_attending = db.relationship("Event", secondary="guest_event_link") def __repr__(self): """Define how we want this to look when printed.""" return self.name
class Event(db.Model): """Create Event model.""" id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(90), nullable=False) description = db.Column(db.String(140), nullable=False) date = db.Column(db.DateTime, nullable=False) time = db.Column(db.DateTime, nullable=False) guests = db.relationship("Guest", secondary="guest_event_link") def __repr__(self): """Define how we want this to look when printed.""" return self.title, self.description
class Guest(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(25), nullable=False) email = db.Column(db.String(50), nullable=False, unique=True) phone = db.Column(db.String(15), nullable=True, unique=True) events_attending = db.relationship('Event', secondary='guest_event', back_populates='guests') def __str__(self): return f'<Guest: {self.name}>' def __repr__(self): return f'<Guest: {self.name}>'
class Guest(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80), nullable=False) email = db.Column(db.String(80), nullable=False) phone = db.Column(db.Integer, nullable=False) # - events_attending: relationship to "Event" table with a secondary table events_attending = db.relationship('Event', secondary='guest_event_table', back_populates='guests') def __str__(self): return f'<Guest: {self.name}>' def __repr__(self): return f'<Guest: {self.name}>'
class User(db.Model): """Class User represents the user table in our SQL database.""" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(40), nullable=False) username = db.Column(db.String(40), nullable=False) email = db.Column(db.String(30), nullable=False) password = db.Column(db.String(120), nullable=True) is_admin = db.Column(db.Boolean, nullable=False, default=False) avatar = db.Column( db.String(30), nullable=False, default="lucifer.jpeg", )
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80), nullable=False) description = db.Column(db.String(80), nullable=False) date_and_time = db.Column(db.Integer, nullable=False) guests = db.relationship('Guest', secondary='guest_event_table', back_populates='events_attending') # `event_type` as an Enum column that denotes the # type of event event_type = db.Column(db.Enum(Event_type), default=Event_type.ALL) def __str__(self): return f'<Event: {self.title}>' def __repr__(self): return f'<Event: {self.title}>'
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80), unique=True, nullable=False) description = db.Column(db.Text, nullable=False) date_and_time = db.Column(db.DateTime, nullable=False) guests = db.relationship("Guest", secondary="guest_event_table", back_populates="events_attending") event_type = db.Column(db.Enum(Event_Type), default=Event_Type.PARTY)
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80), nullable=False) description = db.Column(db.String(80), nullable=False) date_and_time = db.Column(db.DateTime, default=datetime.datetime.utcnow) guests = db.relationship('Guest', secondary="guest_event")