Example #1
0
def createTopic(question, accountId, answerStatusId, isPoll):

    qst = Question()

    qst.Question = question
    qst.AccountId = accountId
    qst.TimeStamp = datetime.date.today()
    qst.AnswerStatusId = answerStatusId
    qst.IsPoll = isPoll
    qst.Score = 0

    db.session.add(qst)
    db.session.commit()
Example #2
0
model.db.session.add(ans)
model.db.session.commit()

questions = [
    'LE BEC DE BONNE ESPÉRANCE À AMBÈS',
    'DES GALERIES TECHNIQUES MAGIQUES À BORDEAUX',
    '« VAGUE REBELLE ET PISCINE GÉANTE SUR LA GARONNE » À BORDEAUX',
]
for i in range(len(questions)):
    question = Question()
    question.TimeStamp = datetime.date.today()
    question.AnswerStatusId = 1
    question.IsPoll = True
    question.Score = 0
    question.AccountId = i + 1
    question.Question = questions[i]
    model.db.session.add(question)
    model.db.session.commit()

for domain in [
        'voierie', 'environnement', 'politique', 'sociologue', 'philosophe',
        'économie'
]:
    d = DomainExpertise()
    d.Name = domain
    model.db.session.add(d)
model.db.session.commit()

accountDomainExpertise = AccountDomainExpertise()
accountDomainExpertise.DomainExpertiseId = 1