Fake Data Generator for SMS
This directory contains a Django management command to generate fake data for testing the School Management System (SMS).
Prerequisites
Before using this script, make sure you have installed the required packages:
pip install faker
Usage
Run the command using Django's manage.py:
python manage.py generate_fake_data
Options
The script accepts the following optional parameters:
--students: Number of students to create (default: 50)--staff: Number of staff members to create (default: 20)--parents: Number of parents to create (default: 40)--courses: Number of courses to create (default: 5)--subjects: Number of subjects per course (default: 4)--clear: Clear existing data before generating new data (flag)
Examples
Generate data with default parameters:
python manage.py generate_fake_data
Generate a smaller dataset:
python manage.py generate_fake_data --students 20 --staff 10 --parents 15
Clear existing data and generate new data:
python manage.py generate_fake_data --clear
Generated Data
The script generates the following types of data:
- Institute information
- Batches (last 4 years)
- Courses with customized names and durations
- Subjects for each course
- Staff members with profiles and credentials
- Students with profiles and course assignments
- Parents linked to students
- Class routines and schedules
- Attendance records for past two weeks
- Notices/announcements
- Leave requests for students and staff
- Feedback (student, parent, institute)
- Parent-teacher meetings
- Course tracking records
Login Credentials
The generated users have the following default passwords:
- Students:
student123 - Regular Staff/Teachers:
staff123 - Department Heads (HOD):
hod1234 - Admission Officers:
admissionofficer123 - Parents:
parent123
User Groups
The following user groups are created automatically:
- Student
- Teacher
- HOD (Department Heads)
- Admission Officer
- Parent
Each group has appropriate permissions assigned based on their role in the system.
Phone Numbers
All users are assigned unique 10-digit Nepali phone numbers (e.g., 98xxxxxxxx, 97xxxxxxxx). These phone numbers are used as the username for authentication.
Note
The script doesn't generate actual file content for subject files due to the limitation of creating binary content programmatically. This portion is commented out in the code.
Troubleshooting
If you encounter issues with transactions or database errors, try running the command with the --clear flag to start with a clean database before generating new data.