summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/forms.py53
-rw-r--r--yaksh/models.py6
-rw-r--r--yaksh/test_views.py11
3 files changed, 58 insertions, 12 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py
index 6fbaf5d..1d18d29 100644
--- a/yaksh/forms.py
+++ b/yaksh/forms.py
@@ -9,6 +9,7 @@ from taggit.managers import TaggableManager
from taggit.forms import TagField
from django.forms.models import inlineformset_factory
from django.db.models import Q
+from textwrap import dedent
try:
from string import letters
except ImportError:
@@ -165,6 +166,58 @@ class QuizForm(forms.ModelForm):
self.fields['prerequisite'].required = False
self.fields['course'] = forms.ModelChoiceField(
queryset=Course.objects.filter(id=course_id), empty_label=None)
+ self.fields["instructions"].initial = dedent("""\
+ <p>
+ This examination system has been
+ developed with the intention of
+ making you learn programming and
+ be assessed in an interactive and
+ fun manner.
+ You will be presented with a
+ series of programming questions
+ and problems that you will answer
+ online and get immediate
+ feedback for.
+ </p>
+ <p>
+ Here are some important
+ instructions and rules that you
+ should understand carefully.</p>
+ <ul>
+ <li>For any programming questions,
+ you can submit solutions as many
+ times as you want without a
+ penalty. You may skip questions
+ and solve them later.</li>
+ <li> You <strong>may</strong>
+ use your computer's Python/IPython
+ shell or an editor to solve the
+ problem and cut/paste the
+ solution to the web interface.
+ </li>
+ <li> <strong>You are not allowed
+ to use any internet resources,
+ i.e. no google etc.</strong>
+ </li>
+ <li> Do not copy or share the
+ questions or answers with anyone
+ until the exam is complete
+ <strong>for everyone</strong>.
+ </li>
+ <li> <strong>All</strong> your
+ attempts at the questions are
+ logged. Do not try to outsmart
+ and break the testing system.
+ If you do, we know who you are
+ and we will expel you from the
+ course. You have been warned.
+ </li>
+ </ul>
+ <p>
+ We hope you enjoy taking this
+ exam !!!
+ </p>
+ """)
class Meta:
model = Quiz
diff --git a/yaksh/models.py b/yaksh/models.py
index 2bf4a85..04bdd24 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -81,10 +81,6 @@ def has_profile(user):
def get_upload_dir(instance, filename):
return "question_%s/%s" % (instance.question.id, filename)
-def get_quiz_instructions_info():
- file_path = os.path.join(os.getcwd(), "Quiz_instructions.txt")
- with open(file_path, 'r') as file:
- return file.read()
###############################################################################
class CourseManager(models.Manager):
@@ -550,7 +546,7 @@ class Quiz(models.Model):
is_trial = models.BooleanField(default=False)
instructions = models.TextField('Instructions for Students',
- default=get_quiz_instructions_info)
+ default=None, blank=True, null=True)
view_answerpaper = models.BooleanField('Allow student to view their answer\
paper', default=False)
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index 2419591..e052441 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -146,9 +146,6 @@ class TestAddQuiz(TestCase):
self.mod_group = Group.objects.create(name='moderator')
tzone = pytz.timezone('UTC')
- file_path = os.path.join(os.getcwd(), "Quiz_instructions.txt")
- with open(file_path, 'r') as file:
- self.file_data = file.read()
# Create Moderator with profile
self.user_plaintext_pass = 'demo'
self.user = User.objects.create_user(
@@ -187,7 +184,7 @@ class TestAddQuiz(TestCase):
self.pre_req_quiz = Quiz.objects.create(
start_date_time=datetime(2014, 2, 1, 5, 8, 15, 0, tzone),
end_date_time=datetime(2015, 10, 9, 10, 8, 15, 0, tzone),
- duration=30, active=True, instructions=self.file_data,
+ duration=30, active=True, instructions="Demo Instructions",
attempts_allowed=-1, time_between_attempts=0,
description='pre requisite quiz', pass_criteria=40,
language='Python', prerequisite=None,
@@ -197,7 +194,7 @@ class TestAddQuiz(TestCase):
self.quiz = Quiz.objects.create(
start_date_time=datetime(2014, 10, 9, 10, 8, 15, 0, tzone),
end_date_time=datetime(2015, 10, 9, 10, 8, 15, 0, tzone),
- duration=30, active=True, instructions=self.file_data,
+ duration=30, active=True, instructions="Demo Instructions",
attempts_allowed=-1, time_between_attempts=0,
description='demo quiz', pass_criteria=40,
language='Python', prerequisite=self.pre_req_quiz,
@@ -274,7 +271,7 @@ class TestAddQuiz(TestCase):
'description': 'updated demo quiz',
'pass_criteria': 40,
'language': 'java',
- 'instructions': self.file_data,
+ 'instructions': "Demo Instructions",
'prerequisite': self.pre_req_quiz.id,
'course': self.course.id
}
@@ -321,7 +318,7 @@ class TestAddQuiz(TestCase):
'description': 'new demo quiz',
'pass_criteria': 50,
'language': 'python',
- 'instructions': self.file_data,
+ 'instructions': "Demo Instructions",
'prerequisite': self.pre_req_quiz.id,
'course': self.course.id
}