Skip to content

Commit

Permalink
NEW: support for subjective questions
Browse files Browse the repository at this point in the history
  • Loading branch information
dalmia committed Jun 5, 2021
1 parent 9b06bd3 commit f75d9fa
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plio/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
plio_status_choices = [("draft", "Draft"), ("published", "Published")]
item_type_choices = [("question", "Question")]
question_type_choices = [("mcq", "Multiple Choice Question")]
question_type_choices = [
("mcq", "Multiple Choice Question"),
("subjective", "Subjective Question"),
]
30 changes: 30 additions & 0 deletions plio/migrations/0019_auto_20210604_1021.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 3.1.1 on 2021-06-04 10:21

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("plio", "0018_auto_20210414_1200"),
]

operations = [
migrations.AddField(
model_name="question",
name="max_char_limit",
field=models.FloatField(null=True),
),
migrations.AlterField(
model_name="question",
name="type",
field=models.CharField(
choices=[
("mcq", "Multiple Choice Question"),
("subjective", "Subjective Question"),
],
default="mcq",
max_length=255,
),
),
]
18 changes: 18 additions & 0 deletions plio/migrations/0020_question_has_char_limit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.1 on 2021-06-04 12:30

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("plio", "0019_auto_20210604_1021"),
]

operations = [
migrations.AddField(
model_name="question",
name="has_char_limit",
field=models.BooleanField(default=False),
),
]
2 changes: 2 additions & 0 deletions plio/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class Question(SafeDeleteModel):
correct_answer = models.TextField(null=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
has_char_limit = models.BooleanField(default=False)
max_char_limit = models.FloatField(null=True)

class Meta:
db_table = "question"
2 changes: 2 additions & 0 deletions plio/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class Meta:
"type",
"options",
"correct_answer",
"has_char_limit",
"max_char_limit",
"created_at",
"updated_at",
]

0 comments on commit f75d9fa

Please sign in to comment.