Rendering course contents
Once students are enrolled in courses, they need a central location to access all courses they are signed up for. We need to compile the list of courses the student is enrolled in and provide access to the contents of each course. Then, we need to implement a system to render various types of content, such as text, images, videos and documents, which make up the course modules. Let’s build the necessary views and templates for users to access course contents.
Accessing course contents
You need a view for displaying the courses that students are enrolled in and a view for accessing the actual course contents. Edit the views.py
file of the students
application and add the following code to it:
from django.views.generic.list import ListView
from courses.models import Course
class StudentCourseListView(LoginRequiredMixin, ListView):
model = Course
template_name = 'students/course/list.html'
def get_queryset(self):
...