You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
738 B
21 lines
738 B
from extensions import db
|
|
|
|
|
|
class Question(db.Model):
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
text = db.Column(db.String(255), nullable=False)
|
|
choices = db.relationship('Choice', backref='question', lazy=True)
|
|
|
|
|
|
class Choice(db.Model):
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
text = db.Column(db.String(255), nullable=False)
|
|
question_id = db.Column(db.Integer, db.ForeignKey(
|
|
'question.id'), nullable=False)
|
|
|
|
# Nieuwe kolom voor de volgende vraag
|
|
next_question_id = db.Column(
|
|
db.Integer, db.ForeignKey('question.id'), nullable=True)
|
|
next_question = db.relationship('Question', foreign_keys=[
|
|
next_question_id], backref='previous_choices')
|