Assignment python and databse

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Assignment: Student and Course Information Management Dashboard

You have been tasked with developing a web application using Flask and MySQL
to manage student and course information. The application should facilitate CRUD
(Create, Read, Update, Delete) operations for both students and courses, and
display a dashboard interface for easy management.

Requirements:

1. Database Setup:
o Create a MySQL database named students_db.
o Design the following tables:
 students:
 id (INT, Primary Key, Auto Increment)
 name (VARCHAR(100))
 age (INT)
 grade (FLOAT)
 courses:
 id (INT, Primary Key, Auto Increment)
 name (VARCHAR(100))
 description (TEXT)
 student_courses:
 student_id (INT, Foreign Key referencing students.id)
 course_id (INT, Foreign Key referencing courses.id)
 Primary Key on (student_id, course_id)
2. Flask Application:
o Implement a Flask application (app.py) with the following routes:
 /: Display a dashboard with sections for managing both students
and courses.
 Students Management:
 /students: Display a table listing all students with options
to add, update, and delete students.
 /students/add: Form to add a new student. Upon
submission, insert the student record into the students
table.
 /students/update/<int:id>: Form to update an existing
student record identified by <int:id>.

Upon submission, update the corresponding record in the


students table.
/students/delete/<int:id>: Delete the student record

identified by <int:id> from the students table.
 Courses Management:
 /courses: Display a table listing all courses with options
to add, update, and delete courses.
 /courses/add: Form to add a new course. Upon
submission, insert the course record into the courses
table.
 /courses/update/<int:id>: Form to update an existing
course record identified by <int:id>. Upon submission,
update the corresponding record in the courses table.
 /courses/delete/<int:id>: Delete the course record
identified by <int:id> from the courses table.
3. Front-End Interface:
o Create HTML templates (index.html, students.html, courses.html) for
the dashboard and management pages.
 Ensure each page includes forms for adding and updating
records, and tables for listing records with appropriate action
buttons.
4. Database Relations:
o Implement a many-to-many relationship between students and courses
using the student_courses table.
o Ensure proper linking and retrieval of data to display courses enrolled
by each student.

Instructions:

 Use Flask for routing


 Use MySQL Connector/Python for database connectivity.
 Implement basic security measures, such as input validation

Submission:

Submit the following:

 Complete source code (app.py, HTML templates).


 SQL script (students_db.sql) for creating the database and table structures.
Evaluation Criteria:

Your assignment will be evaluated based on:

 Correct implementation of CRUD operations for both students and courses.


 User interface design and usability.
 Code organization, clarity, and adherence to Python and Flask best practices.
 Proper handling of database relationships and data integrity.

You might also like