-
Notifications
You must be signed in to change notification settings - Fork 45
[42] participant and hacknight model relationship #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[42] participant and hacknight model relationship #45
Conversation
backend/models.py
Outdated
hacknights = db.relationship("Hacknight", | ||
secondary=participant_hacknight, | ||
lazy='subquery', | ||
backref=db.backref('participants', lazy=True)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like bidirectional many to many relationship. So either you should remove one relationship (from child class), or use back_populates instead of backref if you would like to keep this two directions.
backend/models.py
Outdated
'participant_hacknight', | ||
db.Column('participant_id', db.Integer, db.ForeignKey('participant.id')), | ||
db.Column('hacknight.id', db.Integer, db.ForeignKey('hacknight.id')) | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Association table should be before participant and hacknight models
participants = db.relationship("Participant", | ||
secondary=participant_hacknight, | ||
lazy='subquery', | ||
backref=db.backref('hacknights', lazy=True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to fix it in #43
participants = db.relationship("Participant", | ||
secondary=participant_hacknight, | ||
lazy='subquery', | ||
backref=db.backref('hacknights', lazy=True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to fix it in #43
No description provided.