diff --git a/quiz/views.py b/quiz/views.py index bb4c380..8fac91d 100644 --- a/quiz/views.py +++ b/quiz/views.py @@ -111,10 +111,10 @@ class MCQuestionCreate(CreateView): form_class = MCQuestionForm template_name = "quiz/mcquestion_form.html" - def get_form_kwargs(self): - kwargs = super().get_form_kwargs() - kwargs["quiz"] = get_object_or_404(Quiz, id=self.kwargs["quiz_id"]) - return kwargs + # def get_form_kwargs(self): + # kwargs = super().get_form_kwargs() + # kwargs["quiz"] = get_object_or_404(Quiz, id=self.kwargs["quiz_id"]) + # return kwargs def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) @@ -134,10 +134,20 @@ class MCQuestionCreate(CreateView): formset = context["formset"] if formset.is_valid(): with transaction.atomic(): - form.instance.quiz = get_object_or_404(Quiz, id=self.kwargs["quiz_id"]) - self.object = form.save() + # Save the MCQuestion instance without committing to the database yet + self.object = form.save(commit=False) + self.object.save() + + # Retrieve the Quiz instance + quiz = get_object_or_404(Quiz, id=self.kwargs["quiz_id"]) + + # set the many-to-many relationship + self.object.quiz.add(quiz) + + # Save the formset (choices for the question) formset.instance = self.object formset.save() + if "another" in self.request.POST: return redirect( "mc_create", diff --git a/templates/core/index.html b/templates/core/index.html index f6a5f45..045c546 100644 --- a/templates/core/index.html +++ b/templates/core/index.html @@ -49,9 +49,9 @@ {% endif %} diff --git a/templates/course/course_single.html b/templates/course/course_single.html index 27ff2c9..d261250 100644 --- a/templates/course/course_single.html +++ b/templates/course/course_single.html @@ -107,7 +107,7 @@ {% trans 'No video Uploaded.' %} {% if request.user.is_superuser or request.user.is_lecturer %} - + {% trans 'Upload now.' %} @@ -184,7 +184,7 @@ {% trans 'No File Uploaded.' %} {% if request.user.is_superuser or request.user.is_lecturer %} - + {% trans 'Upload now.' %} diff --git a/templates/course/program_single.html b/templates/course/program_single.html index c1ae053..c04e9f8 100644 --- a/templates/course/program_single.html +++ b/templates/course/program_single.html @@ -95,7 +95,7 @@ {% trans 'No course for this progrm.' %} {% if request.user.is_superuser %} - + {% trans 'Add one now.' %} diff --git a/templates/quiz/mcquestion_form.html b/templates/quiz/mcquestion_form.html index a4808f2..8489716 100644 --- a/templates/quiz/mcquestion_form.html +++ b/templates/quiz/mcquestion_form.html @@ -52,7 +52,7 @@
{{ fs.correct }} {% trans 'Correct' %}
- {{ fs.choice }} + {{ fs.choice_text }}
{{ fs.DELETE }} {% trans 'Delete' %}
diff --git a/templates/quiz/progress.html b/templates/quiz/progress.html index 183c090..5b1971b 100644 --- a/templates/quiz/progress.html +++ b/templates/quiz/progress.html @@ -95,7 +95,7 @@ {% endif %} {% if not cat_scores and not exams %} -

{% trans 'No recordes yet. Try to do some quizzes in your course.' %}
+

{% trans 'No recordes yet' %}
{% endif %} {% endblock %} diff --git a/templates/quiz/quiz_marking_detail.html b/templates/quiz/quiz_marking_detail.html index 8a449e7..afaea9f 100644 --- a/templates/quiz/quiz_marking_detail.html +++ b/templates/quiz/quiz_marking_detail.html @@ -14,7 +14,7 @@ -
{{ sitting.quiz }} +
{% trans "Quiz title" %}: {{ sitting.quiz.title }}
{% trans "Category" %}: {{ sitting.quiz.category }}
diff --git a/templates/setting/admin_panel.html b/templates/setting/admin_panel.html index b66a447..e9bcaef 100644 --- a/templates/setting/admin_panel.html +++ b/templates/setting/admin_panel.html @@ -34,17 +34,17 @@
- {% trans 'Manage' %}{% trans 'Lecturers' %} » + {% trans 'Manage' %} {% trans 'Lecturers' %} »

CRUD (Create, Retrieve, Update & Delete) lecturers

- {% trans 'Manage' %}{% trans 'Students' %} » + {% trans 'Manage' %} {% trans 'Students' %} »

CRUD (Create, Retrieve, Update & Delete) {% trans 'students' %}

- {% trans 'Manage' %}{% trans 'Session' %} » + {% trans 'Manage' %} {% trans 'Session' %} »

CRUD (Create, Retrieve, Update & Delete) {% trans 'sessions' %}

diff --git a/templates/sidebar.html b/templates/sidebar.html index e8df7ae..fe2558d 100644 --- a/templates/sidebar.html +++ b/templates/sidebar.html @@ -108,7 +108,7 @@ {% endif %}
-

→ Others

+

→ Others

  • {% trans 'Account Setting' %}