{"id":49338416,"url":"https://github.com/christiangarcia0311/django-model-seeder","last_synced_at":"2026-04-27T02:31:10.335Z","repository":{"id":345519180,"uuid":"1182502515","full_name":"christiangarcia0311/django-model-seeder","owner":"christiangarcia0311","description":"A Django library powered by data-seed-ph for generating realistic, synthetic Philippine-based datasets directly into Django models. Designed for database seeding and API testing, it allows developers to quickly populate Django applications with structured test data using simple and customizable Django management commands.","archived":false,"fork":false,"pushed_at":"2026-03-19T13:32:20.000Z","size":23,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-20T05:11:08.007Z","etag":null,"topics":["database-seeding","django-models","python-library"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/django-model-seeder/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christiangarcia0311.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-15T15:57:58.000Z","updated_at":"2026-03-19T14:35:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/christiangarcia0311/django-model-seeder","commit_stats":null,"previous_names":["christiangarcia0311/django-model-seeder"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/christiangarcia0311/django-model-seeder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christiangarcia0311%2Fdjango-model-seeder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christiangarcia0311%2Fdjango-model-seeder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christiangarcia0311%2Fdjango-model-seeder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christiangarcia0311%2Fdjango-model-seeder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christiangarcia0311","download_url":"https://codeload.github.com/christiangarcia0311/django-model-seeder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christiangarcia0311%2Fdjango-model-seeder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32320177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database-seeding","django-models","python-library"],"created_at":"2026-04-27T02:31:09.819Z","updated_at":"2026-04-27T02:31:10.320Z","avatar_url":"https://github.com/christiangarcia0311.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Django Model Seeder\n\n[![GitHub stars](https://img.shields.io/github/stars/christiangarcia0311/django-model-seeder?style=social)](https://github.com/christiangarcia0311/django-model-seeder/stargazers)\n[![GitHub issues](https://img.shields.io/github/issues/christiangarcia0311/django-model-seeder?style=flat)](https://github.com/christiangarcia0311/django-model-seeder/issues)\n![Static Badge](https://img.shields.io/badge/License-MIT-orange?style=flat)\n![Static Badge](https://img.shields.io/badge/Github-django_model_seeder-green?style=flat\u0026logo=github)\n![Static Badge](https://img.shields.io/badge/Pypi-django_model_seeder-blue?style=flat\u0026logo=pypi\u0026logoColor=white)\n![Static Badge](https://img.shields.io/badge/Django-5.2+-green?style=flat\u0026logo=django\u0026logoColor=white)\n![Static Badge](https://img.shields.io/badge/Python-3.9+-blue?style=flat\u0026logo=python\u0026logoColor=white)\n[![Last commit](https://img.shields.io/github/last-commit/christiangarcia0311/django-model-seeder?style=flat)](https://github.com/christiangarcia0311/django-model-seeder/commits/main)\n[![Latest release](https://img.shields.io/github/v/release/christiangarcia0311/django-model-seeder?style=flat)](https://github.com/christiangarcia0311/django-model-seeder/releases/latest)\n[![PyPI Downloads](https://static.pepy.tech/personalized-badge/django-model-seeder?period=total\u0026units=NONE\u0026left_color=GRAY\u0026right_color=GREEN\u0026left_text=downloads)](https://pepy.tech/projects/django-model-seeder)\n\n**Command-based synthetic data generation and seeding for Django models using [data-seed-ph](https://github.com/christiangarcia0311/data-seed-ph).**\n\n\u003e[!NOTE]\n\u003e Designed for rapid database population in development environments, API testing, QA automation, and demo applications with seamless integration to Django's management command system.\n\n#### Why Django Model Seeder\n\nPopulating Django databases with realistic test data can be repetitive and time-consuming. Django Model Seeder simplifies this process by offering powerful management commands that automatically generate realistic Philippine-based synthetic data and insert it directly into your Django models, eliminating the need for manual data seeding scripts.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Configuration](#configuration)\n  - [JSON Configuration](#json-configuration)\n  - [YAML Configuration](#yaml-configuration)\n- [Management Commands](#management-commands)\n  - [seed_models](#1-seed_models-command)\n  - [clear_seeds](#2-clear_seeds-command)\n  - [list_seeds](#3-list_seeds-command)\n- [Data Generation Types](#data-generation-types)\n- [Advanced Usage](#advanced-usage)\n- [Use Cases](#use-cases)\n- [Important Notes](#important-notes)\n- [Troubleshooting](#troubleshooting)\n- [Library Source](#library-source)\n- [License](#license)\n\n### Installation\n\nInstall via python package index [Pypi]().\n\n```bash\npip install django-model-seeder\n```\n\n### Quick Start\n\nAdd `django_seeder` to your Django `INSTALLED_APPS`:\n\n```python\nINSTALLED_APPS = [\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'django.contrib.messages',\n    'django.contrib.staticfiles',\n    'django_seeder',\n    'your_app_name',\n]\n```\n\nCreate Database model in your `app/models.py` file:\n\n```python\nfrom django.db import models\n\nclass Artist(models.Model):\n    firstname = models.CharField(max_length=100)\n    lastname = models.CharField(max_length=100)\n    email = models.EmailField()\n```\n\nCreate `fixtures/seed_config.json` file:\n\n```json\n{\n    \"Artist\": {\n        \"app_label\": \"music_app\",\n        \"rows\": 30,\n        \"mapping\": {\n            \"firstname\": \"firstname\",\n            \"lastname\": \"lastname\",\n            \"email\": \"email\"\n        }\n    }\n}\n```\n\nRun seeding command:\n\n```bash\npython manage.py seed_models --config fixtures/seed_config.json\n```\n\nOutput of the command and check your database for confirmation:\n\n```bash\nLoaded config from fixtures/seed_config.json\nSeeding successfully completed\nArtist: 30 rows seeded\n```\n\n## Configuration\n\n### JSON Configuration\n\nDefine your seeding configuration in JSON format:\n\n```json\n{\n    \"ModelName\": {\n        \"app_label\": \"app_label_name\",\n        \"rows\": \"number_of_rows\",\n        \"mapping\": {\n            \"field_name\": \"data_generator_keyword_or_custom_values\"\n        }\n    }\n}\n```\n\n#### Example:\n\n```json\n{\n    \"Artist\": {\n        \"app_label\": \"music_app\",\n        \"rows\": 30,\n        \"mapping\": {\n            \"firstname\": \"firstname\",\n            \"lastname\": \"lastname\",\n            \"email\": \"email\",\n            \"birthdate\": \"birthdate\"\n        }\n    },\n    \"Album\": {\n      \"app_label\": \"music_app\",\n        \"rows\": 100,\n        \"mapping\": {\n            \"category\": [\"Jazz\", \"Rock\", \"RnB\"],\n            \"rating\": [0.0, 5.0, \"float\"],\n            \"views\": [0, 50000]\n        }\n    }\n}\n```\n\n### YAML Configuration\n\nDefine your seeding configuration in YAML format:\n\n```yaml\nArtist:\n    app_label: app_label_name\n    rows: number_of_rows\n    mapping:\n        field_name: data_generator_keyword_or_custom_values\n```\n\n#### Example:\n\n```yaml\nArtist:\n    app_label: music_app\n    rows: 50\n    mapping:\n        firstname: firstname\n        lastname: lastname\n        email: email\n        birthdate: birthdate\nAlbum:\n    rows: 100\n    mapping: \n        category:\n            - Jazz\n            - Rock\n            - RnB\n        rating:\n            - 0.0\n            - 5.0\n            - float\n        views:\n            - 0\n            - 50000\n```\n\n## Management Commands\n\n#### **1. `seed_models` command**\n\nSeed Django models with synthetic data from configuration files or direct arguments.\n\n**Syntax**:\n\n```bash\npython manage.py seed_models [OPTIONS]\n```\n\n**Options**:\n\n| Option | Type | Default | Description |\n| :--- | :---: | :---: | :--- |\n| `--config` | str | None | Path to seed configuration file (JSON or YAML) |\n| `--model` | str | None | Specific model to seed (format: ModelName) |\n| `--app` | str | None | Django app label |\n| `--rows` | int | 10 | Number of rows to seed |\n| `--clear` | flag | False | Clear existing data before seeding |\n| `--dry-run` | flag | False | Show what would be seeded without actually seeding |\n| `--verbose` | flag | False | Show detailed output including sample records |\n\n**Examples**\n\nFrom configuration file:\n\n```bash\npython manage.py seed_models --config fixtures/seed_config.json\n```\n\nFrom configuration file with verbose output:\n\n```bash\npython manage.py seed_models --config fixtures/seed_config.json --verbose\n```\n\nClear existing data and reseed:\n\n```bash\npython manage.py seed_models --config fixtures/seed_config.json --clear\n```\n\nDry run preview:\n\n```bash\npython manage.py seed_models --config fixtures/seed_config.json --dry-run\n```\n\nSeed specific model or auto-generated mapping with arguments:\n\n```bash\npython manage.py seed_models --model Artist --app music_app --rows 50\n```\n\nSeed specific model and clear first:\n\n```bash\npython manage.py seed_models --model Artist --app music_app --rows 50 \n```\n\n#### **2. `clear_seeds` command**\n\nClear seeded data from Django models.\n\n**Syntax**:\n\n```bash\npython manage.py clear_seeds [OPTIONS]\n```\n\n**Options**:\n\n| Option | Type | Default | Description |\n| :--- | :---: | :---: | :--- |\n| `--model` | str | None | Specific model to clear (format: ModelName) |\n| `--app` | str | None | Django app label |\n| `--all` | flag | False | Clear data from all models |\n| `--confirm` | flag | False | Skip confirmation prompt |\n\n\n**Examples**\n\nClear specific model with confirmation:\n\n```bash\npython manage.py clear_seeds --model Artist --app music_app\n```\n\nClear specific model without confirmation:\n\n```bash\npython manage.py clear_seeds --model Artist --app music_app --confirm\n```\n\nClear all seeded data with confirmation:\n\n```bash\npython manage.py clear_seeds --all\n```\n\nClear all seeded data without confirmation:\n\n```bash\npython manage.py clear_seeds --all --confirm\n```\n\n#### **3. `list_seeds` command**\n\nList all available Django models for seeding with optional record counts.\n\n**Syntax**:\n\n```bash\npython manage.py list_seeds [OPTIONS]\n```\n\n**Options**:\n\n| Option | Type | Default | Description |\n| :--- | :---: | :---: | :--- |\n| `--app` | str | None | Django app label |\n| `--count` | flag | False | Show record count each model |\n\n**Examples**\n\nList all available models:\n\n```bash\npython manage.py list_seeds\n```\n\nList models in specific app:\n\n```bash\npython manage.py list_seeds --app music_app\n```\n\nList models with record counts:\n\n```bash\npython manage.py list_seeds --count\n```\n\nList models in specific app with counts:\n\n```bash\npython manage.py list_seeds --app music_app --count\n```\n\n## Data Generation Types\n\n**1. String Keywords**\n\nUse built-in data generators with string keywords from [Data Seed PH](https://github.com/christiangarcia0311/data-seed-ph?tab=readme-ov-file#features).\n\n**Examples**\n\n```json\n{\n    \"Artist\": {\n        \"app_label\": \"music_app\",\n        \"rows\": 30,\n        \"mapping\": {\n            \"firstname\": \"firstname\",\n            \"lastname\": \"lastname\",\n            \"email\": \"email\",\n            \"birthdate\": \"birthdate\"\n        }\n    }\n}\n```\n\n**2. Numeric Ranges (Tuples)**\n\nGenerate random integers ot floats within specified ranges.\n\n\u003e [!NOTE]\n\u003e JSON lists are converted into tuples when generating data with specified ranges.\n\n```json\n{\n    \"Album\": {\n        \"app_label\": \"music_app\",\n        \"rows\": 100,\n        \"mapping\": {\n            \"likes\": [0, 100000],\n            \"rating\": [0.0, 5.0, \"float\"],\n            \"views\": [0, 50000]\n        }\n    }\n}\n```\n\n**Format**\n\n- Integer range: `[min, max]`\n- Float range: `[min, max, \"float\"]`\n\n\n**3. Categorical Values (Lists)**\n\nChoose randomly from predefined options.\n\n```json\n{\n    \"Album\": {\n        \"app_label\": \"music_app\",\n        \"rows\": 100,\n        \"mapping\": {\n            \"catgeory\": [\"RnB\", \"Rock\", \"Hip-Hop\", \"Jazz\"],\n            \"album_type\": [\"Studio Album\", \"Live Album\", \"Single\", \"EP\"],\n            \"release_format\": [\"Digital\", \"CD\"]\n        }\n    }\n}\n```\n\n**4. Parameterized Keywords**\n\nSome generators accept parameters using colon syntax:\n\n\u003e [!NOTE]\n\u003e Parameterized keywords only available in `AddressDataProvider` provider within [Data Seed PH](https://github.com/christiangarcia0311/data-seed-ph?tab=readme-ov-file#features) library.\n\n```json\n{\n  \"Location\": {\n    \"app_label\": \"geoprroject\",\n    \"rows\": 30,\n    \"mapping\": {\n      \"addr_province\": \"province:Surigao Del Norte\",\n      \"addr_municipality\": \"municipality:Claver\",\n      \"addr_barangay\": \"barangay\"\n    }\n  }\n}\n```\n\n**Supported field types**\n\n- `CharField`, `TextField`: string keywords or lists\n- `IntegerField`: tuples with int range\n- `FloatField`: tuples with float range\n- `DateField`: date keywords like `birthdate`\n- `EmailField`: `email` keyword\n- `ForeignKey`: handled programmatically (see [Advanced Usage](#advanced-usage))\n\n### Advanced Usage\n\n**Models with Foreign Key Relations**\n\nSeed models with foreign key relationships using the `relations` key in your configuration file.\n\nExample Django Models in `music_app/models.py`:\n\n```python\nfrom django.db import models\n\nclass Artist(models.Model):\n    firstname = models.CharField(max_length=100)\n    lastname = models.CharField(max_length=100)\n    email = models.EmailField(unique=True)\n    phone = models.CharField(max_length=20)\n    age = models.IntegerField()\n\nclass Album(models.Model):\n    title = models.CharField(max_length=200)\n    artist = models.ForeignKey(Artist, on_delete=models.CASCADE, related_name='albums')\n    description = models.TextField()\n    genre = models.CharField(max_length=100)\n    release_year = models.IntegerField()\n    streams = models.IntegerField(default=0)\n    rating = models.FloatField(default=0.0)\n\nclass Review(models.Model):\n    album = models.ForeignKey(Album, on_delete=models.CASCADE, related_name='reviews')\n    reviewer_name = models.CharField(max_length=100)\n    feedback = models.TextField()\n    email = models.EmailField()\n    rating = models.IntegerField()\n```\n\nConfiguration with Relations (JSON) file in `fixtures/seed_config.json`:\n\n```json\n{\n  \"Artist\": {\n    \"app_label\": \"music_app\",\n    \"rows\": 20,\n    \"mapping\": {\n      \"firstname\": \"firstname\",\n      \"lastname\": \"lastname\",\n      \"email\": \"email\",\n      \"phone\": \"mobile\",\n      \"age\": [25, 65]\n    }\n  },\n  \"Album\": {\n    \"app_label\": \"music_app\",\n    \"rows\": 100,\n    \"mapping\": {\n      \"title\": [\"Echoes of Time\", \"Midnight Dreams\", \"Silver Linings\"],\n      \"description\": \"fulladdress\",\n      \"genre\": \"course\",\n      \"release_year\": [2015, 2024],\n      \"streams\": [0, 1000000],\n      \"rating\": [1.0, 5.0, \"float\"]\n    },\n    \"relations\": {\n      \"artist\": \"Artist\"\n    }\n  },\n  \"Review\": {\n    \"app_label\": \"music_app\",\n    \"rows\": 250,\n    \"mapping\": {\n      \"reviewer_name\": \"fullname\",\n      \"feedback\": \"fulladdress\",\n      \"email\": \"email\",\n      \"rating\": [1, 5]\n    },\n    \"relations\": {\n      \"album\": \"Album\"\n    }\n  }\n}\n```\n\nConfiguration with Relation (YAML) file in `fixtures/seed_config.yaml`:\n\n```yaml\nArtist:\n  app_label: music_app\n  rows: 20\n  mapping:\n    firstname: firstname\n    lastname: lastname\n    email: email\n    phone: mobile\n    age:\n      - 25\n      - 65\n\nAlbum:\n  app_label: music_app\n  rows: 100\n  mapping:\n    title:\n      - Echoes of Time\n      - Midnight Dreams\n      - Silver Linings\n    description: fulladdress\n    genre: course\n    release_year:\n      - 2015\n      - 2024\n    streams:\n      - 0\n      - 1000000\n    rating:\n      - 1.0\n      - 5.0\n      - float\n  relations:\n    artist: Artist\n\nReview:\n  app_label: music_app\n  rows: 250\n  mapping:\n    reviewer_name: fullname\n    feedback: fulladdress\n    email: email\n    rating:\n      - 1\n      - 5\n  relations:\n    album: Album\n```\n\n**How Relations Work**\n\nThe `relations` key links foreign keys to parent models:\n\n- `\"artist\": \"Artist\"`: Each Album gets a random Artist from existing Artist records\n- `\"album\": \"Album\"`: Each Review gets a random Album from existing Album records\n\n### Use Cases\n\n- **Development**: Populate databases with realistic test data during development\n\n- **Testing**: Seed test databases for integration and end-to-end tests\n\n- **API Testing**: Generate test payloads and bulk request data for API endpoint testing\n\n- **QA Automation**: Quickly set up test databases for QA testing cycles\n\n- **Demo Applications**: Build convincing demos with realistic Philippine synthetic data\n\n- **Load Testing**: Create large datasets for performance and stress testing\n\n- **Staging Environments**: Pre-populate staging databases with realistic data\n\n- **Documentation**: Generate example data for README and API documentation\n\n- **Database Backup Testing**: Restore and verify database backups with synthetic data\n\n### Important Notes\n\n\u003e [!IMPORTANT]\n\u003e Synthetic Data Disclaimer: All generated data is random and synthetic. It does NOT represent real individuals, real addresses, or real contact information. Use this library only for development, testing, and non-production environments.\n\n\u003e [!TIP]\n\u003e Related Library: Django Model Seeder uses [data-seed-ph](https://github.com/christiangarcia0311/data-seed-ph) library for authentic Philippine synthetic data generation.\n\n\u003e [!WARNING]\n\u003e Avoid seeding production databases. Always use this library in development and testing environments only.\n\n### Troubleshooting\n\n**1. Command Not Found**\n\n**Error:** `django.core.management.base.CommandError: No app with label 'django_seeder'`\n\n**Solution:** Ensure `django_seeder` is added to `INSTALLED_APPS` in `settings.py`\n\n```python\nINSTALLED_APPS = [\n    ...\n    'django_seeder',\n    ...\n]\n```\n\n**2. Configuration File Not Found**\n\n**Error:** `FileNotFoundError: Configuration file not found`\n\n**Solution:** Ensure the config file path is correct and relative to your project root\n\n```bash\npython manage.py seed_models --config fixtures/seed_config.json\n```\n\n**3. Import Errors**\n\n**Error:** `ModuleNotFoundError: No module named 'data_seed_ph'`\n\n**Solution:** Install the dependency\n\n```bash\npip install data-seed-ph\n```\n\n**4. Module Not Found**\n\n**Error:** `LookupError: Model not found: myapp.Author`\n\n**Solution:** Verify app label and model name are correct\n\n```bash\npython manage.py list_seeds\n```\n\n**5. Invalid JSON Configuration**\n\n**Error:** `InvalidConfigurationError: Invalid configuration file format`\n\n**Solution:** Validate JSON syntax using an online validate or:\n\n```bash\npython -m json.tool fixtures/seed_config.json\n```\n\n### Library Source \n\n- [Data Seed PH](https://github.com/christiangarcia0311/data-seed-ph)\n- [Django Documentation](https://docs.djangoproject.com/)\n- [Django Management Commands](https://docs.djangoproject.com/en/6.0/howto/custom-management-commands/)\n\n### Releases\n\n[See releases](https://github.com/christiangarcia0311/django-model-seeder/releases)\n\n### License\n\nMIT License - See [LICENSE](/LICENSE) file for details.\n\n\n### Author\n\n[\u003cimg src=\"https://github.com/christiangarcia0311.png\" width=\"80px;\" style=\"border-radius: 100%;\"\u003e](https://github.com/christiangarcia0311)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristiangarcia0311%2Fdjango-model-seeder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristiangarcia0311%2Fdjango-model-seeder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristiangarcia0311%2Fdjango-model-seeder/lists"}