-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfaker.py
More file actions
25 lines (24 loc) · 688 Bytes
/
Copy pathfaker.py
File metadata and controls
25 lines (24 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from Quiz.models import Quiz, QuizQuestion, Option, CorrectOption
from Accounts.models import UserAccount
# CREATING QUIZ
author = UserAccount.objects.get(id=2)
quiz_obj = Quiz.objects.create(
author_id=author,
title="C Programming Quiz",
description="Basic C Questions",
no_of_question=5,
time_limit=15
)
quiz_question = QuizQuestion.objects.create(
quiz_id = quiz_obj,
question_text = "What is the size of char data type"
)
for i in range(4):
option_obj = Option.objects.create(
question_id = quiz_question,
option = f"{i+1} byte"
)
correct = CorrectOption.objects.create(
question_id = quiz_question,
correct = option_obj
)