コード例 #1
0
class GuestEventLink(db.Model):
    """Joining table for guests & events."""

    id = db.Column(db.Integer, primary_key=True)
    guest_id = db.Column(db.Integer, db.ForeignKey("guest.id"))
    event_id = db.Column(db.Integer, db.ForeignKey("event.id"))
    event = db.relationship("Event",
                            backref=backref("link",
                                            cascade="all, delete-orphan"))
    guest = db.relationship("Guest",
                            backref=backref("link",
                                            cascade="all, delete-orphan"))
コード例 #2
0
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")
コード例 #3
0
ファイル: models.py プロジェクト: Ignl94/bew_events
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
コード例 #4
0
ファイル: models.py プロジェクト: Ignl94/bew_events
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')
コード例 #5
0
ファイル: models.py プロジェクト: Pondorasti/BEW-1.2
class Event(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String)
    description = db.Column(db.String)
    date_and_time = db.Column(db.DateTime)
    event_type = db.Column(db.Enum(PartyType), default=PartyType.Party)
    guests = db.relationship("Guest", secondary="guest_events")
コード例 #6
0
ファイル: models.py プロジェクト: asood92/events-hw
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, nullable=False)
    date_and_time = db.Column(db.DateTime, nullable=False)
    guests = db.relationship(
        "Guest", secondary="guest_events", back_populates="events_attending"
    )
コード例 #7
0
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')
コード例 #8
0
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")
コード例 #9
0
ファイル: models.py プロジェクト: JustJoshRiley/Events
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))
コード例 #10
0
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)
コード例 #11
0
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)
コード例 #12
0
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')
コード例 #13
0
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')
コード例 #14
0
class Event(db.Model):
    """Event model."""
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), nullable=False)
    description = db.Column(db.String(1000), nullable=False)
    date_and_time = db.Column(db.DateTime, nullable=False)
    # event_type = db.Column(db.Enum, nullable = True)
    guests = db.relationship("Guest",
                             secondary="guest_event_table",
                             back_populates="events_attending")
コード例 #15
0
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')
コード例 #16
0
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')
コード例 #17
0
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')
コード例 #18
0
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')
コード例 #19
0
ファイル: models.py プロジェクト: brianross93/flaskformsbew12
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')
コード例 #20
0
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}>'
コード例 #21
0
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}'
コード例 #22
0
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')
コード例 #23
0
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")
コード例 #24
0
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
コード例 #25
0
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
コード例 #26
0
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}>'
コード例 #27
0
ファイル: models.py プロジェクト: LWRGitHub/events-app
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}>'
コード例 #28
0
ファイル: models.py プロジェクト: LWRGitHub/events-app
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}>'
コード例 #29
0
class Event(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String, nullable=False)
    description = db.Column(db.String, nullable=False)
    date_and_time = db.Column(db.DateTime, nullable=False)
    guests = db.relationship('Guest',
                             secondary='guest_event',
                             back_populates='events_attending')
    event_type = db.Column(db.Enum(Event_Type),
                           default=Event_Type.STUDY,
                           nullable=True)

    def __str__(self):
        return f'<Event: {self.title}>'

    def __repr__(self):
        return f'<Event: {self.title}>'
コード例 #30
0
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")