adilmohak / django-lms

A learning management system using django web framework. Course add and drop, grade and assessment result management, online quiz, report generator, student and lecturers management, dashboard, and so much more...
MIT License
584 stars 251 forks source link

Dummy Data Generation Utility #28

Closed WajahatKanju closed 9 months ago

WajahatKanju commented 9 months ago

Pull Request: Adding Fake Data Generation Utility to Django Project

Overview

This pull request introduces a utility for generating fake data within the Django project, addressing Issue #24 . Fake data generation is a valuable tool for various purposes, including testing, development, and demonstration. This utility leverages the Faker library to create realistic and randomized data for different models in the project. Additionally, the Django Extensions package is integrated to provide a convenient command-line interface for executing the data generation script.

Purpose of Fake Data Generation

Testing

Development

Demonstration and Presentation

Usage Examples

Command-line Usage

Download The additional Dependencies

pip install django django-extensions faker factory_boy

Run the script

python manage.py runscript generate_fake_data

This command executes the generate_fake_data script, which generates fake data for different models in the Django project. The script utilizes the Faker library and Django Extensions to create realistic and randomized data efficiently.

Handling Unique Constraints

In case of IntegrityErrors due to unique constraints, the script gracefully handles the situation by regenerating usernames to ensure uniqueness.

Conclusion

Integrating a fake data generation utility into the Django project enhances testing, development, and presentation processes. It enables developers to create realistic datasets efficiently and effectively, facilitating thorough testing, rapid prototyping, and compelling demonstrations.

This pull request also includes the integration of Django Extensions for a seamless command-line interface, simplifying the execution of the data generation script.

adilmohak commented 9 months ago

Well done @WajahatKanju !