0% found this document useful (0 votes)
25 views

#37 View Course (Forntend & Backend)

The document describes the folder structure and files used to build a course management system with a frontend and backend. It includes a sidebar template to navigate to add and view course pages. The view course page URL pattern retrieves all courses from the database and passes them to the view course template to display the course list.

Uploaded by

Shubham Bhade
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

#37 View Course (Forntend & Backend)

The document describes the folder structure and files used to build a course management system with a frontend and backend. It includes a sidebar template to navigate to add and view course pages. The view course page URL pattern retrieves all courses from the database and passes them to the view course template to display the course list.

Uploaded by

Shubham Bhade
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#37 view Course (Forntend & Backend )

-------------------------------------------------

Folder Structure
-------------------
-templates
--Hod
---view_course.html
--includes
---sidebar.html

sidebar.html
--------------------
<li class="submenu {% active_link 'add_course' 'active' %} {% active_link
'view_course' 'active' %}">
<a href="#"><i class="fa fa-graduation-cap"></i> <span> Course</span> <span
class="menu-arrow"></span></a>
<ul>
<li><a href="{% url 'add_course' %}">Add Course</a></li>
<li><a href="{% url 'view_course' %}">View Course</a></li>
</ul>
</li>

urls.py
-----------
path('Hod/Course/View',Hod_Views.VIEW_COURSE,name='view_course'),

Hod_Views.html
---------------------
@login_required(login_url='/')
def VIEW_COURSE(request):
course = Course.objects.all()
context = {
'course':course,
}
return render(request,'Hod/view_course.html',context)

view_course.html
-------------------------
{% extends 'base.html' %}
{% block content %}
{% load static %}
<div class="content container-fluid">
<div class="page-header">
<div class="row align-items-center">
<div class="col">
<h3 class="page-title">Students</h3>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="index.html">Dashboard</a></li>
<li class="breadcrumb-item active">Students</li>
</ul>
</div>
<div class="col-auto text-right float-right ml-auto">
<a href="#" class="btn btn-outline-primary mr-2"><i class="fas fa-
download"></i> Download</a>
<a href="add-student.html" class="btn btn-primary"><i class="fas fa-
plus"></i></a>
</div>
</div>
</div>
{% include 'includes/messages.html' %}
<div class="row">
<div class="col-sm-12">
<div class="card card-table">
<div class="card-body">
<div class="table-responsive">
<table id="table_id" class="table table-hover table-center mb-0">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Created_at</th>
<th>updated_at</th>
<th class="text-right">Action</th>
</tr>
</thead>
<tbody>
{% for i in course %}
<tr>
<td>{{i.id}}</td>
<td>{{i.name}}</td>
<td>{{i.created_at}}</td>
<td>{{i.updated_at}}</td>
<td class="text-right">
<div class="actions">
<a href="{% url 'edit_course' i.id %}" class="btn
btn-sm bg-success-light mr-2">
<i class="fas fa-pen"></i>
</a>
<a href="{% url 'delete_course' i.id %}"
class="btn btn-sm bg-danger-light">
<i class="fas fa-trash"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

You might also like