In this project, we implement an assessment feature to an Online Course Application. The feature allows learners to take an exam, submit their answers, and get results based on their performance. This process includes creating models, handling form submissions, displaying dynamic content in templates, and providing feedback to the learner.
We created the following models:
- Course: Represents the course details.
- Enrollment: Links a learner to a specific course.
- Question: Represents a question in the exam.
- Choice: Represents possible answers for each question.
- Submission: Stores learner responses and links to an enrollment.
These models allow for the creation of relationships between courses, students, questions, and answers.
After creating models, we registered them in Django's admin panel for easy management. This allows us to add courses, questions, and choices directly via the admin interface.
We updated the course_details_bootstrap.html template to display:
- The exam questions for the course.
- The choices for each question in a user-friendly, Bootstrap-styled interface.
- An option to start the exam when the user is authenticated.
We added sample test data including:
- Instructor (admin user).
- Course: "Learning Django", with lessons and course content.
- Test Questions with correct and incorrect choices.
We implemented the submit view that:
- Captures answers submitted by the learner.
- Creates a new Submission record.
- Compares answers with the correct choices and calculates the score.
- Redirects the user to the exam result page.
We created the exam_result_bootstrap.html template to display:
- The learnerβs total score.
- Whether the learner passed or failed the exam.
- Feedback on each question showing:
- Correct answers.
- Incorrect answers with an option to retake the exam.
This was all styled using Bootstrap to create a responsive, user-friendly interface.
- Django: Backend framework for creating models, handling forms, and rendering templates.
- Bootstrap: Frontend framework for styling the templates.
- Python: Programming language for implementing the business logic and views.
- HTML/CSS: For structuring and styling the course exam interface.
-
Clone the repository:
git clone <repo-url> cd <repo-directory>
-
Install dependencies:
Ensure you have
virtualenvinstalled and create a virtual environment.python -m venv venv source venv/bin/activate # For MacOS/Linux venv\Scripts\activate # For Windows pip install -r requirements.txt
-
Run migrations to set up the database:
python manage.py migrate
-
Create a superuser to access the Django admin panel:
python manage.py createsuperuser
-
Run the development server:
python manage.py runserver
-
Access the application by visiting
http://127.0.0.1:8000in your browser. -
Login to the Django Admin panel to manage data (courses, questions, etc.) by navigating to
http://127.0.0.1:8000/admin/.
- Learner Enrollment: Users can enroll in courses by signing up and selecting courses.
- Exam Start: Once enrolled, they can start the exam by clicking the "Start Exam" button.
- Answer Submission: Learners choose their answers from a list of multiple-choice questions, and then submit their answers.
- Exam Results: After submission, learners are redirected to a results page showing their score, whether they passed or failed, and feedback on their answers.
- Multiple Choice Questions: Each question can have multiple correct choices, and the user selects the answers they think are correct.
- Dynamic Exam Interface: The exam interface is updated dynamically based on the questions and choices for each course.
- Results Feedback: Learners receive detailed feedback on their answers, including which choices were correct or incorrect, and their overall score.
- Admin Panel: Instructors and admins can manage courses, questions, and choices through the Django admin panel.
- Willie Conway
- Yan Luo
- Muhammad Yahya
This project is part of the IBM Developer Skills Network. All rights reserved by IBM Corporation.
Feel free to contribute or ask any questions regarding the project! π




