This Django project is a simple web application for managing employee and department records. The project includes basic CRUD functionality for both employees and departments, as well as a relationship between employees and departments.
To run this Django project, you will need the following:
- Python 3.x
- Django 3.x
- MySQL
To install and run the project, follow these steps:
- Clone the project repository to your local machine.
- Create a virtual environment for the project:
python -m venv env
- Activate the virtual environment:
source env/bin/activate
(on Linux/Mac) orenv\Scripts\activate
(on Windows) - Install the project dependencies:
pip install -r requirements.txt
- Create a MySQL database and update the
DATABASES
settings in thesettings.py
file to point to your database. - Run the database migrations:
python manage.py migrate
- Start the Django development server:
python manage.py runserver
- Access the web application at
http://localhost:8000/
Once the web application is running, you can use it to perform CRUD operations on employees and departments. Here's a brief overview of the functionality provided by the application:
The employee CRUD functionality allows you to create, read, update, and delete employee records. To access the employee CRUD pages, navigate to http://localhost:8000/employee/
.
To create a new employee record, click the "Add New Employee" button on the employees list page. You will be taken to a form where you can enter the employee details and submit the form to create the record.
To view the details of an existing employee record, click the "Show" button next to the employee's name on the employees list page. You will be taken to a page displaying the employee details.
To update an existing employee record, click the "Edit" button next to the employee's name on the employees list page. You will be taken to a form where you can update the employee details and submit the form to save the changes.
To delete an existing employee record, click the "Delete" button next to the employee's name on the employees list page.
The department CRUD functionality allows you to create, read, update, and delete department records. To access the department CRUD pages, navigate to http://localhost:8000/departments/
.
To create a new department record, click the "Add New Department" button on the departments list page. You will be taken to a form where you can enter the department details and submit the form to create the record.
To view the details of an existing department record, click the "Show" button next to the department's name on the department list page. You will be taken to a page displaying the department details.
To update an existing department record, click the "Edit" button next to the department's name on the departments list page. You will be taken to a form where you can update the department details and submit the form to save the changes.
To delete an existing department record, click the "Delete" button next to the department's name on the departments list page.
In addition to basic employee and department CRUD functionality, the application also supports a relationship between employees and departments. Each employee record is associated with a department record.