/.coveragerc
/coverage_html_report/
/htmlcov/
-/uploads/
\ No newline at end of file
+/uploads/
+from django.utils.translation import ugettext as _
from quiz.models import Question
return unicode(self.content)
class Meta:
- verbose_name = "Essay style question"
+ verbose_name = _("Essay style question")
+ verbose_name_plural = _("Essay style questions")
--- /dev/null
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+#
+# , 2014.
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-10-02 16:35+0000\n"
+"PO-Revision-Date: 2014-10-02 20:35+0400\n"
+"Last-Translator: \n"
+"Language-Team: American English <kde-i18n-doc@kde.org>\n"
+"Language: en_US\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+"X-Generator: Lokalize 1.5\n"
+
+#: models.py:7 models.py:61
+msgid "Content"
+msgstr "Содержание"
+
+#: models.py:8
+msgid "Random"
+msgstr "Случайно"
+
+#: models.py:9
+msgid "None"
+msgstr "Ничего"
+
+#: models.py:17
+msgid "The order in which multichoice answer options are displayed to the user"
+msgstr "Порядок отображения вопросов"
+
+#: models.py:20
+msgid "Answer Order"
+msgstr "Порядок вопросов"
+
+#: models.py:50
+msgid "Multiple Choice Question"
+msgstr "Вопрос с несколькими вариантами ответов"
+
+#: models.py:51
+msgid "Multiple Choice Questions"
+msgstr "Вопросы с несколькими вариантами ответов"
+
+#: models.py:55
+msgid "Question"
+msgstr "Вопрос"
+
+#: models.py:59
+msgid "Enter the answer text that you want displayed"
+msgstr "Введите текст ответа"
+
+#: models.py:65
+msgid "Is this a correct answer?"
+msgstr "Это правильный ответ?"
+
+#: models.py:66
+msgid "Correct"
+msgstr "Правильно"
+
+#: models.py:72
+msgid "Answer"
+msgstr "Вопрос"
+
+#: models.py:73
+msgid "Answers"
+msgstr "Вопросы"
+
+from django.utils.translation import ugettext as _
from django.db import models
from quiz.models import Question
+
ANSWER_ORDER_OPTIONS = (
- ('content', 'Content'),
- ('random', 'Random'),
- ('none', 'None'),
+ ('content', _('Content')),
+ ('random', _('Random')),
+ ('none', _('None'))
)
answer_order = models.CharField(max_length=30, null=True, blank=True,
choices=ANSWER_ORDER_OPTIONS,
- help_text="The order in which multichoice "
- "answer options are displayed "
- "to the user")
+ help_text=_("The order in which multichoice "
+ "answer options are displayed "
+ "to the user"),
+ verbose_name=_("Answer Order"))
def check_if_correct(self, guess):
answer = Answer.objects.get(id=guess)
return Answer.objects.get(id=guess).content
class Meta:
- verbose_name = "Multiple Choice Question"
- verbose_name_plural = "Multiple Choice Questions"
+ verbose_name = _("Multiple Choice Question")
+ verbose_name_plural = _("Multiple Choice Questions")
class Answer(models.Model):
- question = models.ForeignKey(MCQuestion)
+ question = models.ForeignKey(MCQuestion, verbose_name=_("Question"))
content = models.CharField(max_length=1000,
blank=False,
- help_text="Enter the answer text that "
- "you want displayed")
+ help_text=_("Enter the answer text that "
+ "you want displayed"),
+ verbose_name=_("Content"))
correct = models.BooleanField(blank=False,
default=False,
- help_text="Is this a correct answer?")
+ help_text=_("Is this a correct answer?"),
+ verbose_name=_("Correct"))
def __unicode__(self):
return unicode(self.content)
+
+ class Meta:
+ verbose_name = _("Answer")
+ verbose_name_plural = _("Answers")
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-10-01 18:01+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+
+#: models.py:26 models.py:33 models.py:48 models.py:77 models.py:536
+#: templates/progress.html:19 templates/quiz/quiz_detail.html:9
+#: templates/quiz/quiz_list.html:13 templates/quiz/sitting_detail.html:10
+msgid "Category"
+msgstr "Категрия"
+
+#: models.py:34
+msgid "Categories"
+msgstr "Категрии"
+
+#: models.py:43 models.py:53 models.py:541
+msgid "Sub-Category"
+msgstr "Под-категория"
+
+#: models.py:54
+msgid "Sub-Categories"
+msgstr "Под-категории"
+
+#: models.py:63 templates/quiz/quiz_list.html:12
+msgid "Title"
+msgstr "Название"
+
+#: models.py:67
+msgid "Description"
+msgstr "Описание"
+
+#: models.py:68
+msgid "a description of the quiz"
+msgstr "описание теста"
+
+#: models.py:72
+msgid "a user friendly url"
+msgstr "url теста"
+
+#: models.py:73
+msgid "user friendly url"
+msgstr "url теста"
+
+#: models.py:81
+msgid "Random Order"
+msgstr "Случайный порядок"
+
+#: models.py:82
+msgid "Display the questions in a random order or as they are set?"
+msgstr "Отображать вопросы в случайном порядке или в порядке добавления?"
+
+#: models.py:87
+msgid "Max Questions"
+msgstr "Максимальное количество вопросов"
+
+#: models.py:88
+msgid "Number of questions to be answered on each attempt."
+msgstr ""
+"Количество вопросов, на которые должны быть даны ответы при каждой попытке"
+
+#: models.py:92
+msgid ""
+"Correct answer is NOT shown after question. Answers displayed at the end."
+msgstr ""
+"Правильный ответ НЕ показан после вопроса. Ответы отображаются после "
+"прохождения теста"
+
+#: models.py:94
+msgid "Answers at end"
+msgstr "Ответы в конце"
+
+#: models.py:98
+msgid ""
+"If yes, the result of each attempt by a user will be stored. Necessary for "
+"marking."
+msgstr "Если отмечено, результаты каждой попытки пользователя будет сохранен"
+
+#: models.py:101
+msgid "Exam Paper"
+msgstr "Экзаменационный лист"
+
+#: models.py:105
+msgid ""
+"If yes, only one attempt by a user will be permitted. Non users cannot sit "
+"this exam."
+msgstr "Если отмечено, пользователю будет разрешена только одна попытка"
+
+#: models.py:108
+msgid "Single Attempt"
+msgstr "Единственная попытка"
+
+#: models.py:112
+msgid "Percentage required to pass exam."
+msgstr "Процент правльных ответов для прохождения теста"
+
+#: models.py:116
+msgid "Displayed if user passes."
+msgstr "Отображается, если пользователь успешно прошел тест"
+
+#: models.py:117
+msgid "Success Text"
+msgstr "Текст в случае успеха"
+
+#: models.py:120
+msgid "Fail Text"
+msgstr "Текст в случае неудачи"
+
+#: models.py:121
+msgid "Displayed if user fails."
+msgstr "Отображается, если пользователь провалил тест"
+
+#: models.py:125
+msgid "Draft"
+msgstr "Черновик"
+
+#: models.py:126
+msgid ""
+"If yes, the quiz is not displayed in the quiz list and can only be taken by "
+"users who can edit quizzes."
+msgstr ""
+
+#: models.py:146 models.py:364 models.py:532
+#: templates/quiz/sitting_list.html:14
+msgid "Quiz"
+msgstr "Тест"
+
+#: models.py:147
+msgid "Quizzes"
+msgstr "Тесты"
+
+#: models.py:186 models.py:362 templates/quiz/sitting_detail.html:13
+#: templates/quiz/sitting_list.html:13
+msgid "User"
+msgstr "Пользователь"
+
+#: models.py:188 templates/progress.html:60
+#: templates/quiz/sitting_detail.html:15 templates/quiz/sitting_list.html:16
+msgid "Score"
+msgstr "Баллы"
+
+#: models.py:193
+msgid "User Progress"
+msgstr "Прогресс пользователя"
+
+#: models.py:194
+msgid "User progress records"
+msgstr "Прогресс пользователя"
+
+#: models.py:254
+msgid "error"
+msgstr "ошибка"
+
+#: models.py:254
+msgid "category does not exist or invalid score"
+msgstr "категории не существует или недопустимый балл"
+
+#: models.py:367
+msgid "Question Order"
+msgstr "Порядок вопросов"
+
+#: models.py:370
+msgid "Question List"
+msgstr "Список вопросов"
+
+#: models.py:373
+msgid "Incorrect questions"
+msgstr "Вопросы, на которые дан неверный ответ"
+
+#: models.py:375
+msgid "Current Score"
+msgstr "Текущий балл"
+
+#: models.py:378
+msgid "Complete"
+msgstr "Завершен"
+
+#: models.py:381
+msgid "User Answers"
+msgstr "Ответы пользователя"
+
+#: models.py:384
+msgid "Start"
+msgstr "Начало"
+
+#: models.py:386
+msgid "End"
+msgstr "Окончание"
+
+#: models.py:391
+msgid "Can see completed exams."
+msgstr "Может просматривать оконченные тесты"
+
+#: models.py:548
+msgid "Figure"
+msgstr "Рисунок"
+
+#: models.py:552
+msgid "Enter the question text that you want displayed"
+msgstr "Введите текст вопроса, который должен отобразиться"
+
+#: models.py:554 models.py:566 templates/question.html:47
+#: templates/quiz/sitting_detail.html:21
+msgid "Question"
+msgstr "Вопрос"
+
+#: models.py:558
+msgid "Explanation to be shown after the question has been answered."
+msgstr "Объяснение показывается после того, как дан ответ на вопрос"
+
+#: models.py:561 templates/question.html:32 templates/result.html:21
+#: templates/result.html.py:87
+msgid "Explanation"
+msgstr "Объяснение"
+
+#: models.py:567
+msgid "Questions"
+msgstr "Вопросы"
+
+#: templates/base.html:7
+msgid "Example Quiz Website"
+msgstr "Тесты"
+
+#: templates/correct_answer.html:6
+msgid "You answered the above question incorrectly"
+msgstr "Вы дали неверный ответ"
+
+#: templates/correct_answer.html:16
+msgid "This is the correct answer"
+msgstr "Это правильный ответ"
+
+#: templates/correct_answer.html:23
+msgid "This was your answer."
+msgstr "Это был ваш ответ"
+
+#: templates/progress.html:6
+msgid "Progress Page"
+msgstr "Страница прогесса"
+
+#: templates/progress.html:7
+msgid "User Progress Page"
+msgstr "Страница прогресса пользователя"
+
+#: templates/progress.html:13
+msgid "Question Category Scores"
+msgstr "Баллы по категориям вопросов"
+
+#: templates/progress.html:20
+msgid "Correctly answererd"
+msgstr "Верных ответов"
+
+#: templates/progress.html:21
+msgid "Incorrect"
+msgstr "Неверных ответов"
+
+#: templates/progress.html:50
+msgid "Previous exam papers"
+msgstr "Список предыдущих экзаменов"
+
+#: templates/progress.html:52
+msgid "Below are the results of exams that you have sat."
+msgstr "Ниже представлены результаты пройденных Вами тестов"
+
+#: templates/progress.html:59
+msgid "Quiz Title"
+msgstr "Название теста"
+
+#: templates/progress.html:61
+msgid "Possible Score"
+msgstr "Возможный балл"
+
+#: templates/question.html:13 templates/result.html:13
+msgid "The previous question"
+msgstr "Предыдущий вопрос"
+
+#: templates/question.html:22
+msgid "Your answer was"
+msgstr "Ваш ответ был"
+
+#: templates/question.html:47
+msgid "of"
+msgstr "из"
+
+#: templates/question.html:52
+msgid "Question category"
+msgstr "Категория вопроса"
+
+#: templates/question.html:74
+msgid "Check"
+msgstr "Ответить"
+
+#: templates/result.html:7
+msgid "Exam Results for"
+msgstr "Результат теста для"
+
+#: templates/result.html:32
+msgid "Exam results"
+msgstr "Результаты тестирования"
+
+#: templates/result.html:34
+msgid "Exam title"
+msgstr "Название теста"
+
+#: templates/result.html:38
+msgid "You answered"
+msgstr "Ваш результат"
+
+#: templates/result.html:38
+msgid "questions correctly out of"
+msgstr "правильных ответов из"
+
+#: templates/result.html:38
+msgid "giving you"
+msgstr "вы дали"
+
+#: templates/result.html:38
+msgid "percent correct"
+msgstr "процент правльных ответов"
+
+#: templates/result.html:48
+msgid "Review the questions below and try the exam again in the future"
+msgstr ""
+"Просмотрите вопросы, представленные ниже и попробуйте пройти тест еще раз"
+
+#: templates/result.html:52
+msgid ""
+"The result of this exam will be stored in your progress section so you can "
+"review and monitor your progression"
+msgstr ""
+"Результаты данного экзамена будут сохранены. Вы сможете просматривать ваш "
+"прогресс"
+
+#: templates/result.html:66
+msgid "Your session score is"
+msgstr "Балл вашей сессии"
+
+#: templates/result.html:66
+msgid "out of a possible"
+msgstr "из возможных"
+
+#: templates/result.html:84
+msgid "Your answer"
+msgstr "Ваш ответ"
+
+#: templates/single_complete.html:13
+msgid "You have already sat this exam and only one sitting is permitted"
+msgstr "Вы уже прошли данный тест. Разрешена только одна попытка"
+
+#: templates/single_complete.html:15
+msgid "This exam is only accessible to signed in users"
+msgstr "Этот тест доступен только зарегистрированным пользователям"
+
+#: templates/view_quiz_category.html:3
+msgid "Quizzes related to"
+msgstr "Тесты относятся к"
+
+#: templates/view_quiz_category.html:6
+msgid "Quizzes in the"
+msgstr "Тесты в"
+
+#: templates/view_quiz_category.html:6
+msgid "category"
+msgstr "категория"
+
+#: templates/view_quiz_category.html:20
+msgid "There are no quizzes"
+msgstr "Тестов нет"
+
+#: templates/quiz/category_list.html:3 templates/quiz/quiz_list.html:3
+#: templates/quiz/sitting_list.html:3
+msgid "All Quizzes"
+msgstr "Все тесты"
+
+#: templates/quiz/category_list.html:6
+msgid "Category list"
+msgstr "Список категорий"
+
+#: templates/quiz/quiz_detail.html:11
+msgid "You will only get one attempt at this quiz"
+msgstr "У вас есть одна попытка для прохождения данного теста"
+
+#: templates/quiz/quiz_detail.html:16
+msgid "Start quiz"
+msgstr "Начать тест"
+
+#: templates/quiz/quiz_list.html:6
+msgid "List of quizzes"
+msgstr "Список тестов"
+
+#: templates/quiz/quiz_list.html:14
+msgid "Exam"
+msgstr "Тестирование"
+
+#: templates/quiz/quiz_list.html:15
+msgid "Single attempt"
+msgstr "Единственная попытка"
+
+#: templates/quiz/quiz_list.html:31 templates/quiz/sitting_list.html:42
+msgid "View details"
+msgstr "Подробнее"
+
+#: templates/quiz/quiz_list.html:41
+msgid "There are no available quizzes"
+msgstr "Доступных тестов нет"
+
+#: templates/quiz/sitting_detail.html:5
+msgid "Result of"
+msgstr "Результаты"
+
+#: templates/quiz/sitting_detail.html:5
+msgid "for"
+msgstr "для"
+
+#: templates/quiz/sitting_detail.html:9
+msgid "Quiz title"
+msgstr "Назвние теста"
+
+#: templates/quiz/sitting_detail.html:14 templates/quiz/sitting_list.html:15
+msgid "Completed"
+msgstr "Завершено"
+
+#: templates/quiz/sitting_detail.html:22
+msgid "User answer"
+msgstr "Ответ пользователя"
+
+#: templates/quiz/sitting_detail.html:41
+msgid "incorrect"
+msgstr "Неверно"
+
+#: templates/quiz/sitting_detail.html:43
+msgid "Correct"
+msgstr "Верно"
+
+#: templates/quiz/sitting_detail.html:49
+msgid "Toggle whether correct"
+msgstr "Изменить результат"
+
+#: templates/quiz/sitting_list.html:6
+msgid "List of complete exams"
+msgstr "Список завершенных тестов"
+
+#: templates/quiz/sitting_list.html:52
+msgid "There are no matching quizzes"
+msgstr "Подходящих тестов нет"
from django.db import models
from django.core.exceptions import ValidationError
from django.core.validators import MaxValueValidator
+from django.utils.translation import ugettext as _
from django.utils.timezone import now
from model_utils.managers import InheritanceManager
class Category(models.Model):
- category = models.CharField(max_length=250,
- blank=True,
- unique=True,
- null=True)
+ category = models.CharField(
+ verbose_name=_("Category"),
+ max_length=250, blank=True,
+ unique=True, null=True)
objects = CategoryManager()
class Meta:
- verbose_name = "Category"
- verbose_name_plural = "Categories"
+ verbose_name = _("Category")
+ verbose_name_plural = _("Categories")
def __unicode__(self):
return unicode(self.category)
class SubCategory(models.Model):
- sub_category = models.CharField(max_length=250,
- blank=True,
- null=True)
+ sub_category = models.CharField(
+ verbose_name=_("Sub-Category"),
+ max_length=250, blank=True, null=True)
+
+ category = models.ForeignKey(
+ Category, null=True, blank=True,
+ verbose_name=_("Category"))
- category = models.ForeignKey(Category,
- null=True,
- blank=True)
objects = CategoryManager()
class Meta:
- verbose_name = "Sub-Category"
- verbose_name_plural = "Sub-Categories"
+ verbose_name = _("Sub-Category")
+ verbose_name_plural = _("Sub-Categories")
def __unicode__(self):
return unicode(self.sub_category + " (" + self.category.category + ")")
class Quiz(models.Model):
- title = models.CharField(max_length=60,
- blank=False)
-
- description = models.TextField(blank=True,
- help_text="a description of the quiz")
-
- url = models.SlugField(max_length=60,
- blank=False,
- help_text="a user friendly url",
- verbose_name="user friendly url")
-
- category = models.ForeignKey(Category,
- null=True,
- blank=True)
-
- random_order = models.BooleanField(blank=False,
- default=False,
- help_text="Display the questions in "
- "a random order or as they "
- "are set?")
-
- max_questions = models.PositiveIntegerField(blank=True,
- null=True,
- help_text="Number of questions"
- " to be answered on"
- " each attempt.")
-
- answers_at_end = models.BooleanField(blank=False,
- default=False,
- help_text="Correct answer is NOT"
- " shown after question."
- " Answers displayed at"
- " the end.")
-
- exam_paper = models.BooleanField(blank=False,
- default=False,
- help_text="If yes, the result of each"
- " attempt by a user will be"
- " stored. Necessary for"
- " marking.")
-
- single_attempt = models.BooleanField(blank=False,
- default=False,
- help_text="If yes, only one attempt"
- " by a user will be"
- " permitted. Non users"
- " cannot sit this exam.")
-
- pass_mark = models.SmallIntegerField(blank=True,
- default=0,
- help_text="Percentage required to"
- " pass exam.",
- validators=[
- MaxValueValidator(100)])
-
- success_text = models.TextField(blank=True,
- help_text="Displayed if user passes.")
-
- fail_text = models.TextField(blank=True,
- help_text="Displayed if user fails.")
-
- draft = models.BooleanField(blank=True,
- default=False,
- help_text="If yes, the quiz is not displayed"
- " in the quiz list and can only be"
- " taken by users who can edit"
- " quizzes.")
+ title = models.CharField(
+ verbose_name=_("Title"),
+ max_length=60, blank=False)
+
+ description = models.TextField(
+ verbose_name=_("Description"),
+ blank=True, help_text=_("a description of the quiz"))
+
+ url = models.SlugField(
+ max_length=60, blank=False,
+ help_text=_("a user friendly url"),
+ verbose_name=_("user friendly url"))
+
+ category = models.ForeignKey(
+ Category, null=True, blank=True,
+ verbose_name=_("Category"))
+
+ random_order = models.BooleanField(
+ blank=False, default=False,
+ verbose_name=_("Random Order"),
+ help_text=_("Display the questions in "
+ "a random order or as they "
+ "are set?"))
+
+ max_questions = models.PositiveIntegerField(
+ blank=True, null=True, verbose_name=_("Max Questions"),
+ help_text=_("Number of questions to be answered on each attempt."))
+
+ answers_at_end = models.BooleanField(
+ blank=False, default=False,
+ help_text=_("Correct answer is NOT shown after question."
+ " Answers displayed at the end."),
+ verbose_name=_("Answers at end"))
+
+ exam_paper = models.BooleanField(
+ blank=False, default=False,
+ help_text=_("If yes, the result of each"
+ " attempt by a user will be"
+ " stored. Necessary for marking."),
+ verbose_name=_("Exam Paper"))
+
+ single_attempt = models.BooleanField(
+ blank=False, default=False,
+ help_text=_("If yes, only one attempt by"
+ " a user will be permitted."
+ " Non users cannot sit this exam."),
+ verbose_name=_("Single Attempt"))
+
+ pass_mark = models.SmallIntegerField(
+ blank=True, default=0,
+ help_text=_("Percentage required to pass exam."),
+ validators=[MaxValueValidator(100)])
+
+ success_text = models.TextField(
+ blank=True, help_text=_("Displayed if user passes."),
+ verbose_name=_("Success Text"))
+
+ fail_text = models.TextField(
+ verbose_name=_("Fail Text"),
+ blank=True, help_text=_("Displayed if user fails."))
+
+ draft = models.BooleanField(
+ blank=True, default=False,
+ verbose_name=_("Draft"),
+ help_text=_("If yes, the quiz is not displayed"
+ " in the quiz list and can only be"
+ " taken by users who can edit"
+ " quizzes."))
def save(self, force_insert=False, force_update=False, *args, **kwargs):
self.url = re.sub('\s+', '-', self.url).lower()
super(Quiz, self).save(force_insert, force_update, *args, **kwargs)
class Meta:
- verbose_name = "Quiz"
- verbose_name_plural = "Quizzes"
+ verbose_name = _("Quiz")
+ verbose_name_plural = _("Quizzes")
def __unicode__(self):
return unicode(self.title)
Data stored in csv using the format:
category, score, possible, category, score, possible, ...
"""
- user = models.OneToOneField("auth.User")
+ user = models.OneToOneField("auth.User", verbose_name=_("User"))
- score = models.CommaSeparatedIntegerField(max_length=1024)
+ score = models.CommaSeparatedIntegerField(max_length=1024, verbose_name=_("Score"))
objects = ProgressManager()
class Meta:
- verbose_name = "User Progress"
- verbose_name_plural = "User progress records"
+ verbose_name = _("User Progress")
+ verbose_name_plural = _("User progress records")
@property
def list_all_cat_scores(self):
possible_to_add,
isinstance(score_to_add, int),
isinstance(possible_to_add, int)]]):
- return "error", "category does not exist or invalid score"
+ return _("error"), _("category does not exist or invalid score")
to_find = re.escape(str(question.category)) +\
r",(?P<score>\d+),(?P<possible>\d+),"
updated_possible = int(match.group('possible')) +\
abs(possible_to_add)
- new_score = (str(question.category) + "," +
- str(updated_score) + "," +
- str(updated_possible) + ",")
+ new_score = u",".join(
+ [
+ unicode(question.category),
+ unicode(updated_score),
+ unicode(updated_possible), u""
+ ])
# swap old score for the new one
self.score = self.score.replace(match.group(), new_score)
else:
# if not present but existing, add with the points passed in
- self.score += (str(question.category) + "," +
- str(score_to_add) + "," +
- str(possible_to_add) + ",")
+ self.score += u",".join(
+ [
+ unicode(question.category),
+ unicode(score_to_add),
+ unicode(possible_to_add),
+ u""
+ ])
self.save()
def show_exams(self):
with the answer the user gave.
"""
- user = models.ForeignKey('auth.User')
+ user = models.ForeignKey('auth.User', verbose_name=_("User"))
- quiz = models.ForeignKey(Quiz)
+ quiz = models.ForeignKey(Quiz, verbose_name=_("Quiz"))
- question_order = models.CommaSeparatedIntegerField(max_length=1024)
+ question_order = models.CommaSeparatedIntegerField(
+ max_length=1024, verbose_name=_("Question Order"))
- question_list = models.CommaSeparatedIntegerField(max_length=1024)
+ question_list = models.CommaSeparatedIntegerField(
+ max_length=1024, verbose_name=_("Question List"))
- incorrect_questions = models.CommaSeparatedIntegerField(max_length=1024,
- blank=True)
+ incorrect_questions = models.CommaSeparatedIntegerField(
+ max_length=1024, blank=True, verbose_name=_("Incorrect questions"))
- current_score = models.IntegerField()
+ current_score = models.IntegerField(verbose_name=_("Current Score"))
- complete = models.BooleanField(default=False, blank=False)
+ complete = models.BooleanField(default=False, blank=False,
+ verbose_name=_("Complete"))
- user_answers = models.TextField(blank=True, default='{}')
+ user_answers = models.TextField(blank=True, default='{}',
+ verbose_name=_("User Answers"))
- start = models.DateTimeField(auto_now_add=True)
+ start = models.DateTimeField(auto_now_add=True,
+ verbose_name=_("Start"))
- end = models.DateTimeField(null=True, blank=True)
+ end = models.DateTimeField(null=True, blank=True, verbose_name=_("End"))
objects = SittingManager()
class Meta:
- permissions = (("view_sittings", "Can see completed exams."),)
+ permissions = (("view_sittings", _("Can see completed exams.")),)
def get_first_question(self):
"""
"""
quiz = models.ManyToManyField(Quiz,
+ verbose_name=_("Quiz"),
blank=True)
category = models.ForeignKey(Category,
+ verbose_name=_("Category"),
blank=True,
null=True)
sub_category = models.ForeignKey(SubCategory,
+ verbose_name=_("Sub-Category"),
blank=True,
null=True)
figure = models.ImageField(upload_to='uploads/%Y/%m/%d',
blank=True,
- null=True)
+ null=True,
+ verbose_name=_("Figure"))
content = models.CharField(max_length=1000,
blank=False,
- help_text="Enter the question text that "
- "you want displayed",
- verbose_name='Question')
+ help_text=_("Enter the question text that "
+ "you want displayed"),
+ verbose_name=_('Question'))
explanation = models.TextField(max_length=2000,
blank=True,
- help_text="Explanation to be shown "
- "after the question has "
- "been answered.",
- verbose_name='Explanation')
+ help_text=_("Explanation to be shown "
+ "after the question has "
+ "been answered."),
+ verbose_name=_('Explanation'))
objects = InheritanceManager()
class Meta:
+ verbose_name = _("Question")
+ verbose_name_plural = _("Questions")
ordering = ['category']
def __unicode__(self):
-
+{% load i18n %}
+{% load staticfiles %}
<!DOCTYPE html>
<html xmlns:fb="http://www.facebook.com/2008/fbml" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta charset="utf-8">
-<title>Example Quiz Website | {% block title %}{% endblock %}</title>
+<title>{% trans "Example Quiz Website" %} | {% block title %}{% endblock %}</title>
<meta name="description" content="{% block description %}{% endblock %}">
<!-- styles -->
-<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
+<link rel="stylesheet" href={% static "bootstrap.min.css"%}>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
-<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
+<script src="{% static "html5.js" %}"></script>
<![endif]-->
</head>
<body>
-
+{% if user.is_authenticated %}
+<nav class="navbar navbar-default">
+ <div class="container-fluid">
+ <a href="{% url "quiz_index" %}"><button class="btn navbar-btn">Тесты</button></a>
+ <a href="{% url "quiz_progress" %}"><button class="btn navbar-btn">Прогресс</button></a>
+ {% if user.is_superuser %}
+ <a href="{% url "quiz_marking" %}"><button class="btn navbar-btn">Результаты</button></a>
+ {% endif %}
+ <a href="{% url "logout-then-login" %}"><button class="btn navbar-btn navbar-right">Выход</button></a>
+ </div>
+</nav>
+{% endif %}
<!-- Before the quiz content -->
<div class="container">
+{% load i18n %}
{% if previous.answers %}
{% if user_was_incorrect %}
<div class="alert alert-error">
- <strong>You answered the above question incorrectly</strong>
+ <strong>{% trans "You answered the above question incorrectly" %}</strong>
</div>
{% endif %}
{% if answer.correct %}
<tr class="success">
<td>{{ answer.content }}</td>
- <td><strong>This is the correct answer</strong></td>
+ <td><strong>{% trans "This is the correct answer" %}</strong></td>
{% else %}
<tr>
<td>{{ answer.content }}</td>
<td>
{% if previous.question_type.MCQuestion %}
{% if answer.id|add:"0" == previous.previous_answer|add:"0" %}
- This was your answer.
+ {% trans "This was your answer." %}
{% endif %}
{% endif %}
</td>
{% extends "base.html" %}
+{% load i18n %}
{% load quiz_tags %}
-{% block title %} Progress Page {% endblock %}
-{% block description %} User Progress Page {% endblock %}
+{% block title %} {% trans "Progress Page" %} {% endblock %}
+{% block description %} {% trans "User Progress Page" %} {% endblock %}
{% block content %}
{% if cat_scores %}
- <h1>Question Category Scores</h1>
+ <h1>{% trans "Question Category Scores" %}</h1>
<table class="table table-bordered table-striped">
<thead>
<tr>
- <th>Category</th>
- <th>Correctly answererd</th>
- <th>Incorrect</th>
+ <th>{% trans "Category" %}</th>
+ <th>{% trans "Correctly answererd" %}</th>
+ <th>{% trans "Incorrect" %}</th>
<th>%</th>
</tr>
</thead>
<hr>
- <h1>Previous exam papers</h1>
+ <h1>{% trans "Previous exam papers" %}</h1>
<p class="lead">
- Below are the results of exams that you have sat.
+ {% trans "Below are the results of exams that you have sat." %}
</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
- <th>Quiz Title</th>
- <th>Score</th>
- <th>Possible Score</th>
+ <th>{% trans "Quiz Title" %}</th>
+ <th>{% trans "Score" %}</th>
+ <th>{% trans "Possible Score" %}</th>
<th>%</th>
</tr>
</thead>
{% extends "base.html" %}
+{% load i18n%}
{% load quiz_tags %}
{% if previous.answers %}
- <p class="muted"><small>The previous question:</small></p>
+ <p class="muted"><small>{% trans "The previous question" %}:</small></p>
<p>{{ previous.previous_question }}</p>
{% if previous.previous_outcome %}
<div class="alert alert-warning">
{% endif %}
<p><small>
- Your answer was </small>
+ {% trans "Your answer was" %} </small>
<strong>
{{ previous.previous_outcome|yesno:"correct,incorrect" }}
</strong>
{% include 'correct_answer.html' %}
- <p><strong>Explanation:</strong></p>
+ <p><strong>{% trans "Explanation" %}:</strong></p>
<div class="well " style="background-color: #fcf8e3;">
<p>{{ previous.previous_question.explanation }}</p>
</div>
{% if progress %}
<div style="float: right;">
-Question {{ progress.0|add:1 }} of {{ progress.1 }}
+{% trans "Question" %} {{ progress.0|add:1 }} {% trans "of" %} {{ progress.1 }}
</div>
{% endif %}
<p>
- <small class="muted">Question category:</small>
+ <small class="muted">{% trans "Question category" %}:</small>
<strong>{{ question.category }}</strong>
</p>
{% endfor %}
</ul>
- <input type="submit" value="Check" class="btn btn-large btn-block btn-warning" >
+ <input type="submit" value={% trans "Check" %} class="btn btn-large btn-block btn-warning" >
</form>
{% endif %}
{% extends 'base.html' %}
-{% block title %}All Quizzes{% endblock %}
+{% load i18n %}
+{% block title %}{% trans "All Quizzes" %}{% endblock %}
{% block content %}
-<h2>Category list</h2>
+<h2>{% trans "Category list" %}</h2>
<ul>
{% for cat in category_list %}
{% extends 'base.html' %}
+{% load i18n %}
{% block title %}
{{ quiz.title }}
{% endblock %}
{% block content %}
<h2>{{ quiz.title }}</h2>
-<h3>Category: {{ quiz.category }}</h3>
+<h3>{% trans "Category" %}: {{ quiz.category }}</h3>
{% if quiz.single_attempt %}
- <h4>You will only get one attempt at this quiz.</h4>
+ <h4>{% trans "You will only get one attempt at this quiz" %}.</h4>
{% endif %}
<p>{{ quiz.description }}</p>
<p>
<a href="{% url 'quiz_question' quiz_name=quiz.url %}">
- Start quiz
+ {% trans "Start quiz" %}
</a>
</p>
{% endblock %}
{% extends 'base.html' %}
-{% block title %}All Quizzes{% endblock %}
+{% load i18n %}
+{% block title %}{% trans "All Quizzes" %}{% endblock %}
{% block content %}
-<h2>List of quizzes</h2>
+<h2>{% trans "List of quizzes" %}</h2>
{% if quiz_list %}
<table class="table table-bordered table-striped">
<thead>
<tr>
- <th>Title</th>
- <th>Category</th>
- <th>Exam</th>
- <th>Single attempt</th>
+ <th>{% trans "Title" %}</th>
+ <th>{% trans "Category" %}</th>
+ <th>{% trans "Exam" %}</th>
+ <th>{% trans "Single attempt" %}</th>
<th></th>
</tr>
</thead>
<td>{{ quiz.single_attempt }}</td>
<td>
<a href="{% url 'quiz_start_page' slug=quiz.url %}">
- View details
+ {% trans "View details" %}
</a>
</tr>
</table>
{% else %}
- <p>There are no available quizzes.</p>
+ <p>{% trans "There are no available quizzes" %}.</p>
{% endif %}
{% endblock %}
{% extends 'base.html' %}
+{% load i18n %}
{% load quiz_tags %}
{% block title %}
-Result of {{ sitting.quiz.title }} for {{ sitting.user }}
+{% trans "Result of" %} {{ sitting.quiz.title }} {% trans "for" %} {{ sitting.user }}
{% endblock %}
{% block content %}
-<h2>Quiz title: {{ sitting.quiz.title }}</h2>
-<h3>Category: {{ sitting.quiz.category }}</h3>
+<h2>{% trans "Quiz title" %}: {{ sitting.quiz.title }}</h2>
+<h3>{% trans "Category" %}: {{ sitting.quiz.category }}</h3>
<p>{{ sitting.quiz.description }}</p>
<hr>
-<p>User: {{ sitting.user }}</p>
-<p>Completed: {{ sitting.end|date }}</p>
-<p>Score: {{ sitting.get_percent_correct }}%</p>
+<p>{% trans "User" %}: {{ sitting.user }}</p>
+<p>{% trans "Completed" %}: {{ sitting.end|date }}</p>
+<p>{% trans "Score" %}: {{ sitting.get_percent_correct }}%</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
- <th>Question</th>
- <th>User answer</th>
+ <th>{% trans "Question" %}</th>
+ <th>{% trans "User answer" %}</th>
<th></th>
<th></th>
</tr>
<td>{{ question|answer_choice_to_string:question.user_answer }}</td>
<td>
{% if question.id in sitting.get_incorrect_questions %}
- <p>incorrect</p>
+ <p>{% trans "incorrect" %}</p>
{% else %}
- <p>Correct</p>
+ <p>{% trans "Correct" %}</p>
{% endif %}
</td>
<td>
<form action="" method="POST">{% csrf_token %}
<input type=hidden name="qid" value="{{ question.id }}">
- <button type="submit">Toggle whether correct</button>
+ <button type="submit" class="btn btn-warning">{% trans "Toggle whether correct" %}</button>
</form>
</td>
</tr>
{% extends 'base.html' %}
-{% block title %}All Quizzes{% endblock %}
+{% load i18n %}
+{% block title %}{% trans "All Quizzes" %}{% endblock %}
{% block content %}
-<h2>List of complete exams</h2>
+<h2>{% trans "List of complete exams" %}</h2>
{% if sitting_list %}
<table class="table table-bordered table-striped">
<thead>
<tr>
- <th>User</th>
- <th>Quiz</th>
- <th>Completed</th>
- <th>Score (%)</th>
+ <th>{% trans "User" %}</th>
+ <th>{% trans "Quiz" %}</th>
+ <th>{% trans "Completed" %}</th>
+ <th>{% trans "Score" %}(%)</th>
<th></th>
</tr>
</thead>
<td><input type="text" name="quiz_filter" /></td>
<td></td>
<td></td>
- <td><button type="submit">Filter</button></td>
+ <td><button type="submit" class="btn btn-default">{% trans "Filter"%}</button></td>
</form>
</tr>
<td>{{ sitting.get_percent_correct }}</td>
<td>
<a href="{% url 'quiz_marking_detail' pk=sitting.id %}">
- View details
+ {% trans "View details" %}
</a>
</tr>
</table>
{% else %}
- <p>There are no matching quizzes.</p>
+ <p>{% trans "There are no matching quizzes" %}.</p>
{% endif %}
{% endblock %}
{% extends "base.html" %}
+{% load i18n %}
{% load quiz_tags %}
{% block title %} {{ quiz.title}} {% endblock %}
-{% block description %} Exam Results for {{ quiz.title }} {% endblock %}
+{% block description %} {% trans "Exam Results for" %} {{ quiz.title }} {% endblock %}
{% block content %}
{% if previous.answers %}
- <p class="muted"><small>The previous question:</small></p>
+ <p class="muted"><small>{% trans "The previous question" %}:</small></p>
<p>{{ previous.previous_question }}</p>
<p>Your answer was
<strong>
</strong>
</p>
{% include 'correct_answer.html' %}
- <p><strong>Explanation:</strong></p>
+ <p><strong>{% trans "Explanation" %}:</strong></p>
<div class="well " style="background-color: #fcf8e3;">
<p>{{ previous.previous_question.explanation }}</p>
</div>
{% if max_score %}
<div>
- <h2>Exam results</h2>
+ <h2>{% trans "Exam results" %}</h2>
<p>
- <small class="muted">Exam title: </small>
+ <small class="muted">{% trans "Exam title" %}: </small>
<strong>{{ quiz.title }}</strong></p>
<p class="lead">
- You answered {{ score }} questions correctly out of {{ max_score }}, giving you {{ percent }} percent correct
+ {% trans "You answered" %} {{ score }} {% trans "questions correctly out of" %} {{ max_score }}, {% trans "giving you" %} {{ percent }} {% trans "percent correct" %}
</p>
{% if quiz.pass_mark %}
{% endif %}
- <p>Review the questions below and try the exam again in the future.</p>
+ <p>{% trans "Review the questions below and try the exam again in the future"%}.</p>
{% if user.is_authenticated %}
- <p>The result of this exam will be stored in your progress section so you can review and monitor your progression.</p>
+ <p>{% trans "The result of this exam will be stored in your progress section so you can review and monitor your progression" %}.</p>
{% endif %}
</div>
{% if possible %}
<p class="lead">
- Your session score is {{ session }} out of a possible {{ possible }}
+ {% trans "Your session score is" %} {{ session }} {% trans "out of a possible" %} {{ possible }}
</p>
<hr>
{% correct_answer_for_all question %}
{% if question.user_answer %}
- <p>Your answer: {{ question|answer_choice_to_string:question.user_answer }}</p>
+ <p>{% trans "Your answer" %}: {{ question|answer_choice_to_string:question.user_answer }}</p>
{% endif %}
- <p><strong>Explanation:</strong></p>
+ <p><strong>{% trans "Explanation" %}:</strong></p>
<div class="well " style="background-color: #fcf8e3;">
<p>{{ question.explanation }}</p>
</div>
{% extends "base.html" %}
+{% load i18n %}
{% load quiz_tags %}
{% if user.is_authenticated %}
- <p>You have already sat this exam and only one sitting is permitted.</p>
+ <p>{% trans "You have already sat this exam and only one sitting is permitted" %}.</p>
{% else %}
- <p>This exam is only accessible to signed in users.</p>
+ <p>{% trans "This exam is only accessible to signed in users" %}.</p>
{% endif %}
-
{% endblock %}
{% extends 'base.html' %}
-{% block title %}Quizzes related to {{ category.category }}{% endblock %}
+{% load i18n %}
+{% block title %}{% trans "Quizzes related to" %} {{ category.category }}{% endblock %}
{% block content %}
-<h1>Quizzes in the <strong>{{ category.category }} </strong>category</h1>
+<h1>{% trans "Quizzes in the" %} <strong>{{ category.category }} </strong>{% trans "category" %}</h1>
{% with object_list as quizzes %}
{% if quizzes %}
{% endfor %}
</ul>
{% else %}
- <p>There are no quizzes</p>
+ <p>{% trans "There are no quizzes" %}</p>
{% endif %}
{% endwith %}
{% endblock %}
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-10-01 17:56+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+
+#: models.py:9
+msgid "Tick this if the question is true. Leave it blank for false."
+msgstr "Отметьте, если ответ на вопрос 'Да'. Оставьте пустым, если ответ 'Нет'"
+
+#: models.py:12
+msgid "Correct"
+msgstr "Правльно"
+
+#: models.py:40
+msgid "True/False Question"
+msgstr "Вопрос с ответом Да/Нет"
+
+#: models.py:41
+msgid "True/False Questions"
+msgstr "Вопросы с ответом Да/Нет"
+from django.utils.translation import ugettext as _
from django.db import models
from quiz.models import Question
class TF_Question(Question):
correct = models.BooleanField(blank=False,
default=False,
- help_text="Tick this if the question "
- "is true. Leave it blank for"
- " false.")
+ help_text=_("Tick this if the question "
+ "is true. Leave it blank for"
+ " false."),
+ verbose_name=_("Correct"))
def check_if_correct(self, guess):
if guess == "True":
return str(guess)
class Meta:
- verbose_name = "True/False Question"
- verbose_name_plural = "True/False Questions"
+ verbose_name = _("True/False Question")
+ verbose_name_plural = _("True/False Questions")
ordering = ['category']