Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
Correct named of child Model used to declare relations in parent Model
Browse files Browse the repository at this point in the history
References: #17
  • Loading branch information
SuyashD95 committed Feb 10, 2021
1 parent fbdd030 commit 8e1ef2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions API/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class UserModel(db.Model):
name = db.Column(db.String(128), unique=True, nullable=False)
password = db.Column(db.String(64), nullable=False)
email = db.Column(db.String(256), nullable=True)
is_admin = db.relationship('Room', backref='user', lazy=True)
sends = db.relationship('Message', backref='user', lazy=True)
is_admin = db.relationship('RoomModel', backref='user', lazy=True)
sends = db.relationship('MessageModel', backref='user', lazy=True)

def __repr__(self):
"""Object representation for a record of User."""
Expand All @@ -40,7 +40,7 @@ class RoomModel(db.Model):
db.ForeignKey('user._id', onupdate='CASCADE', ondelete='CASCADE'),
nullable=False
)
messages = db.relationship('Message', backref='room', lazy=True)
messages = db.relationship('MessageModel', backref='room', lazy=True)

def __repr__(self):
"""Object representation for a record of a Room."""
Expand Down

0 comments on commit 8e1ef2e

Please sign in to comment.