django-data-seed


Namedjango-data-seed JSON
Version 0.4.2 PyPI version JSON
download
home_pagehttps://github.com/rohith-baggam/django-data-seed
SummaryA Django app to generate and seed database models with realistic test data using Faker. Includes features for automatic backup of deleted instances and detailed log entries for instance mutations, ensuring data safety and comprehensive change tracking.
upload_time2024-08-25 18:36:40
maintainerNone
docs_urlNone
authorRohith Baggam
requires_python>=3.7
licenseMIT License
keywords django data seed
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            **Django Data Seed** is a powerful Django application designed to simplify the process of populating your database with realistic test data. By leveraging the Faker library, this package allows you to effortlessly generate random data for your models using a single command via `manage.py`. It is especially beneficial for developers who need diverse datasets to ensure comprehensive test coverage and data integrity.

## Features

- **Comprehensive Data Generation**: Generate random, realistic data for a wide range of Django model fields.
- **Simple Seeding Process**: Seed your database models with randomly generated data using a single command.
- **Complex Relationship Handling**: Seamlessly manage complex relationships between different models.
- **Data Backup and Restoration**: Automatically back up deleted instances and restore them when needed.
- **Detailed Log Entries**: Maintain detailed log entries for instance mutations, allowing you to track changes over time.

## New in Version

### Data Backup Feature

Ensure data safety with the new automatic backup feature. When an instance is deleted, it is stored in the `DjangoSeedDataBackUpModel`. This feature can be enabled in your settings:

```python

ENABLE_DJANGO_DATA_SEED_AUTO_BACKUP = True
```

To disable, set the variable to `False` or remove it entirely. You can restore deleted instances from the Django admin panel by selecting the deleted instance and choosing the "Restore data" option.


### Log Entries for Instance Mutations

Track every change made to your instances with detailed log entries. This feature stores both pre- and post-mutation states of an instance. Enable this feature by adding the following setting:

```python

ENABLE_DJANGO_DATA_SEED_AUTO_LOG_ENTRY = True
```

Restore any instance to a previous state from the admin panel by selecting the log entry and choosing the "Restore data" option.


### Authentication Configurations

To record the user responsible for deletions or mutations, add the middleware to your `settings.py`:

```python

MIDDLEWARE = [
    # other middleware's
    ...
    "django_data_seed.middleware.CurrentUserMiddleware"
]

```

If the default middleware does not suit your authentication system, create a custom middleware:

```python

from django_data_seed.utils.get_user import set_current_user

class YourCustomMiddleware:
    def __init__(self, get_response):
        self.get_response = get_response

    def __call__(self, request):
        set_current_user(request.user)
        response = self.get_response(request)
        return response

```

### Field Generation Updates

- Now supports choices in `CharField` and `JsonField`, allowing for more realistic and varied data generation.

### Enhanced Command Options

- **Target Specific Models**: You can now seed data for a single model using the `django-app` argument in the `manage.py` command:
    
    ```python
    python manage.py seeddata --django-app model_name
    ```
    

## Installation

To install `django-data-seed`, use pip:

```bash
pip install django-data-seed
```

Add `django_data_seed` to your `INSTALLED_APPS` in your Django settings:

```python

INSTALLED_APPS = [
    ...
    'django_data_seed',
    ...
]
```

After adding `django_data_seed` to your `INSTALLED_APPS`, run the following command to apply migrations:

```python
python3 manage.py migrate
```

## Dependencies

The following dependencies are required and will be installed automatically with `django-data-seed`:

- Django (>=3.2)
- Faker (>=8.0.0)
- colorama (>=0.4.6)

You can also install them manually:

```python
pip install Django>=3.2
pip install Faker>=8.0.0
pip install colorama>=0.4.6
```

## Usage

To seed your database, use the `seeddata` command:

```python
python3 manage.py seeddata
```

To specify the number of instances per model:

```python

python3 manage.py seeddata --no-of-objects 100

```

To seed data for a specific Django app:

```python
python3 manage.py seeddata --django-app app_name
```

To seed data for a specific model:

```python
python3 manage.py seeddata --django-model model_name
```

## Supported Versions

### Django Versions

- Django 3.2
- Django 4.0
- Django 4.1

### Python Versions

- Python 3.7
- Python 3.8
- Python 3.9
- Python 3.10

### Operating Systems

- Windows
- macOS
- Linux

### Databases

- MySQL
- PostgreSQL
- SQLite

## License

This project is licensed under the MIT License. See the [LICENSE](https://github.com/rohith-baggam/django-data-seed/blob/main/LICENSE) file for details.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

## Support

For any issues or questions, open an issue on the [GitHub repository](https://github.com/rohith-baggam/django-data-seed).

## Author

Rohith Baggam

[LinkedIn Profile](https://www.linkedin.com/in/rohith-raj-baggam/)

---

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rohith-baggam/django-data-seed",
    "name": "django-data-seed",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "django data seed",
    "author": "Rohith Baggam",
    "author_email": "baggamrohithraj@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f0/16/69817b0a316ad1a2a42c9e495396e81ced0d604b10197e89842c51879598/django-data-seed-0.4.2.tar.gz",
    "platform": null,
    "description": "**Django Data Seed** is a powerful Django application designed to simplify the process of populating your database with realistic test data. By leveraging the Faker library, this package allows you to effortlessly generate random data for your models using a single command via `manage.py`. It is especially beneficial for developers who need diverse datasets to ensure comprehensive test coverage and data integrity.\n\n## Features\n\n- **Comprehensive Data Generation**: Generate random, realistic data for a wide range of Django model fields.\n- **Simple Seeding Process**: Seed your database models with randomly generated data using a single command.\n- **Complex Relationship Handling**: Seamlessly manage complex relationships between different models.\n- **Data Backup and Restoration**: Automatically back up deleted instances and restore them when needed.\n- **Detailed Log Entries**: Maintain detailed log entries for instance mutations, allowing you to track changes over time.\n\n## New in Version\n\n### Data Backup Feature\n\nEnsure data safety with the new automatic backup feature. When an instance is deleted, it is stored in the `DjangoSeedDataBackUpModel`. This feature can be enabled in your settings:\n\n```python\n\nENABLE_DJANGO_DATA_SEED_AUTO_BACKUP = True\n```\n\nTo disable, set the variable to `False` or remove it entirely. You can restore deleted instances from the Django admin panel by selecting the deleted instance and choosing the \"Restore data\" option.\n\n\n### Log Entries for Instance Mutations\n\nTrack every change made to your instances with detailed log entries. This feature stores both pre- and post-mutation states of an instance. Enable this feature by adding the following setting:\n\n```python\n\nENABLE_DJANGO_DATA_SEED_AUTO_LOG_ENTRY = True\n```\n\nRestore any instance to a previous state from the admin panel by selecting the log entry and choosing the \"Restore data\" option.\n\n\n### Authentication Configurations\n\nTo record the user responsible for deletions or mutations, add the middleware to your `settings.py`:\n\n```python\n\nMIDDLEWARE = [\n    # other middleware's\n    ...\n    \"django_data_seed.middleware.CurrentUserMiddleware\"\n]\n\n```\n\nIf the default middleware does not suit your authentication system, create a custom middleware:\n\n```python\n\nfrom django_data_seed.utils.get_user import set_current_user\n\nclass YourCustomMiddleware:\n    def __init__(self, get_response):\n        self.get_response = get_response\n\n    def __call__(self, request):\n        set_current_user(request.user)\n        response = self.get_response(request)\n        return response\n\n```\n\n### Field Generation Updates\n\n- Now supports choices in `CharField` and `JsonField`, allowing for more realistic and varied data generation.\n\n### Enhanced Command Options\n\n- **Target Specific Models**: You can now seed data for a single model using the `django-app` argument in the `manage.py` command:\n    \n    ```python\n    python manage.py seeddata --django-app model_name\n    ```\n    \n\n## Installation\n\nTo install `django-data-seed`, use pip:\n\n```bash\npip install django-data-seed\n```\n\nAdd `django_data_seed` to your `INSTALLED_APPS` in your Django settings:\n\n```python\n\nINSTALLED_APPS = [\n    ...\n    'django_data_seed',\n    ...\n]\n```\n\nAfter adding `django_data_seed` to your `INSTALLED_APPS`, run the following command to apply migrations:\n\n```python\npython3 manage.py migrate\n```\n\n## Dependencies\n\nThe following dependencies are required and will be installed automatically with `django-data-seed`:\n\n- Django (>=3.2)\n- Faker (>=8.0.0)\n- colorama (>=0.4.6)\n\nYou can also install them manually:\n\n```python\npip install Django>=3.2\npip install Faker>=8.0.0\npip install colorama>=0.4.6\n```\n\n## Usage\n\nTo seed your database, use the `seeddata` command:\n\n```python\npython3 manage.py seeddata\n```\n\nTo specify the number of instances per model:\n\n```python\n\npython3 manage.py seeddata --no-of-objects 100\n\n```\n\nTo seed data for a specific Django app:\n\n```python\npython3 manage.py seeddata --django-app app_name\n```\n\nTo seed data for a specific model:\n\n```python\npython3 manage.py seeddata --django-model model_name\n```\n\n## Supported Versions\n\n### Django Versions\n\n- Django 3.2\n- Django 4.0\n- Django 4.1\n\n### Python Versions\n\n- Python 3.7\n- Python 3.8\n- Python 3.9\n- Python 3.10\n\n### Operating Systems\n\n- Windows\n- macOS\n- Linux\n\n### Databases\n\n- MySQL\n- PostgreSQL\n- SQLite\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](https://github.com/rohith-baggam/django-data-seed/blob/main/LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any changes.\n\n## Support\n\nFor any issues or questions, open an issue on the [GitHub repository](https://github.com/rohith-baggam/django-data-seed).\n\n## Author\n\nRohith Baggam\n\n[LinkedIn Profile](https://www.linkedin.com/in/rohith-raj-baggam/)\n\n---\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A Django app to generate and seed database models with realistic test data using Faker. Includes features for automatic backup of deleted instances and detailed log entries for instance mutations, ensuring data safety and comprehensive change tracking.",
    "version": "0.4.2",
    "project_urls": {
        "Bug Reports": "https://github.com/rohith-baggam/django-data-seed/issues",
        "Homepage": "https://github.com/rohith-baggam/django-data-seed",
        "Source": "https://github.com/rohith-baggam/django-data-seed"
    },
    "split_keywords": [
        "django",
        "data",
        "seed"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6138bdcf8dfb3c325ff01fda16a6cfde9392f1d62ddf0d89615012820be67d80",
                "md5": "7f33048ea2b62098a6b40ade35390882",
                "sha256": "15ac7e6c5d00271510f50deed49526dc5610dc98359163caeb93eb11d1952c92"
            },
            "downloads": -1,
            "filename": "django_data_seed-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7f33048ea2b62098a6b40ade35390882",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 33956,
            "upload_time": "2024-08-25T18:36:38",
            "upload_time_iso_8601": "2024-08-25T18:36:38.525274Z",
            "url": "https://files.pythonhosted.org/packages/61/38/bdcf8dfb3c325ff01fda16a6cfde9392f1d62ddf0d89615012820be67d80/django_data_seed-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f01669817b0a316ad1a2a42c9e495396e81ced0d604b10197e89842c51879598",
                "md5": "bbee641b64a8a61bd8e94f6dbdea584b",
                "sha256": "d93be397ee7013123f66521fcf6d7d2a0143bed693f05661aba313ac2c8356d2"
            },
            "downloads": -1,
            "filename": "django-data-seed-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "bbee641b64a8a61bd8e94f6dbdea584b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 26940,
            "upload_time": "2024-08-25T18:36:40",
            "upload_time_iso_8601": "2024-08-25T18:36:40.318162Z",
            "url": "https://files.pythonhosted.org/packages/f0/16/69817b0a316ad1a2a42c9e495396e81ced0d604b10197e89842c51879598/django-data-seed-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-25 18:36:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rohith-baggam",
    "github_project": "django-data-seed",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "django-data-seed"
}
        
Elapsed time: 0.31954s