# Databyte Django App
## General Details
### Description
The digital era sees data growing exponentially. Keeping track of storage usage is more important than ever. The Databyte app aids in this endeavor by offering tools to monitor and compute the storage usage of Django model instances. With its custom field types and automated calculations, integrating storage tracking into your Django project becomes a breeze.
### Features
- **Custom Field Types**: Databyte introduces three custom field types:
- `ExternalStorageTrackingField`: A simple BigIntegerField to keep track of external storage.
- `AutomatedStorageTrackingField`: A BigIntegerField that automatically computes the storage used by its containing record.
- `StorageAwareForeignKey`: A ForeignKey field that indicates to Databyte that it should recognize this parent-child relationship in storage counting.
- **Automated Computation**: Storage usage is computed and updated automatically whenever a record changes.
- **Child Storage Computation**: Automatically aggregates storage information from child records linked via a `StorageAwareForeignKey`.
- **File Storage Calculation**: For models with `FileField` or `ImageField`, Databyte can compute the storage taken up by these files.
- **Dynamic Parent-Child Relationships**: Using the `StorageAwareForeignKey`, you can define which records should contribute to their parent's storage count.
## Setup Instructions
1. **Install the App**:
```
pip install databyte
```
2. **Add the App**:
Include 'databyte' in your INSTALLED_APPS setting.
```python
INSTALLED_APPS = [
...
'databyte',
...
]
```
3. **Run Migrations**:
As with any new app added to a Django project, run migrations:
```
python manage.py makemigrations
python manage.py migrate
```
## Usage
- **Integrate Custom Fields**:
Introduce the `ExternalStorageTrackingField` and `AutomatedStorageTrackingField` in any model you wish to track:
```python
from django.db import models
from databyte.fields import ExternalStorageTrackingField, AutomatedStorageTrackingField
class MyModel(models.Model):
external_storage = ExternalStorageTrackingField()
automated_storage = AutomatedStorageTrackingField(include_in_parents_count=True)
```
- **File Storage**:
If your model has a `FileField` or `ImageField`, Databyte will automatically account for their sizes when computing storage.
- **Parent-Child Relationships**:
Use `StorageAwareForeignKey` to establish which child records should be accounted for in parent records' storage calculations:
```python
from django.db import models
from databyte.fields import StorageAwareForeignKey
class ChildModel(models.Model):
parent = StorageAwareForeignKey(ParentModel, on_delete=models.CASCADE, count_as_storage_parent=True)
```
- **Signal Integration**:
Ensure the signals provided by Databyte are integrated to automatically update storage values on record save and delete events.
## Contributing
As this is an open-source project hosted on GitHub, your contributions and improvements are welcome! Follow these general steps for contributing:
1. **Fork the Repository**:
Start by forking the main repository to your personal GitHub account.
2. **Clone the Forked Repository**:
Clone your forked repository to your local machine.
```
git clone https://github.com/YidiSprei/DjangoDatabyte.git
```
3. **Create a New Branch**:
Before making any changes, create a new branch:
```
git checkout -b feature-name
```
4. **Make Your Changes**:
Implement your features, enhancements, or bug fixes.
5. **Commit & Push**:
```
git add .
git commit -m "Descriptive commit message about changes"
git push origin feature-name
```
6. **Create a Pull Request (PR)**:
Go to your forked repository on GitHub and click the "New Pull Request" button. Make sure the base fork is the original repository, and the head fork is your repository and branch. Fill out the PR template with the necessary details.
Remember to always be respectful and kind in all interactions with the community. It's all about learning, growing, and helping each other succeed!
## Credits
Developed with 💙 by Yidi Sprei. We thank all the contributors and the Django community for their support and inspiration.
Raw data
{
"_id": null,
"home_page": "https://github.com/YidiSprei/DjangoDatabyte.git",
"name": "databyte",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Yidi Sprei",
"author_email": "yidi.sprei@infuzu.com",
"download_url": "https://files.pythonhosted.org/packages/92/11/d0ad5c135712fec39ff59ee91801541fd0fcab46ebb7055f55f7c05ce431/databyte-1.3.tar.gz",
"platform": null,
"description": "\n# Databyte Django App\n\n## General Details\n\n### Description\n\nThe digital era sees data growing exponentially. Keeping track of storage usage is more important than ever. The Databyte app aids in this endeavor by offering tools to monitor and compute the storage usage of Django model instances. With its custom field types and automated calculations, integrating storage tracking into your Django project becomes a breeze.\n### Features\n - **Custom Field Types**: Databyte introduces three custom field types:\n - `ExternalStorageTrackingField`: A simple BigIntegerField to keep track of external storage. \n - `AutomatedStorageTrackingField`: A BigIntegerField that automatically computes the storage used by its containing record.\n - `StorageAwareForeignKey`: A ForeignKey field that indicates to Databyte that it should recognize this parent-child relationship in storage counting.\n\n - **Automated Computation**: Storage usage is computed and updated automatically whenever a record changes.\n\n - **Child Storage Computation**: Automatically aggregates storage information from child records linked via a `StorageAwareForeignKey`.\n\n - **File Storage Calculation**: For models with `FileField` or `ImageField`, Databyte can compute the storage taken up by these files.\n\n - **Dynamic Parent-Child Relationships**: Using the `StorageAwareForeignKey`, you can define which records should contribute to their parent's storage count.\n\n## Setup Instructions\n1. **Install the App**:\n\n ```\n pip install databyte\n ```\n\n2. **Add the App**: \nInclude 'databyte' in your INSTALLED_APPS setting.\n\n ```python\n INSTALLED_APPS = [\n ...\n 'databyte',\n ...\n ]\n ```\n\n3. **Run Migrations**:\nAs with any new app added to a Django project, run migrations:\n\n ```\n python manage.py makemigrations\n python manage.py migrate\n ```\n\n## Usage\n- **Integrate Custom Fields**:\nIntroduce the `ExternalStorageTrackingField` and `AutomatedStorageTrackingField` in any model you wish to track:\n ```python\n from django.db import models\n from databyte.fields import ExternalStorageTrackingField, AutomatedStorageTrackingField\n \n class MyModel(models.Model):\n external_storage = ExternalStorageTrackingField()\n automated_storage = AutomatedStorageTrackingField(include_in_parents_count=True)\n ```\n- **File Storage**:\nIf your model has a `FileField` or `ImageField`, Databyte will automatically account for their sizes when computing storage.\n\n- **Parent-Child Relationships**:\nUse `StorageAwareForeignKey` to establish which child records should be accounted for in parent records' storage calculations:\n ```python\n from django.db import models\n from databyte.fields import StorageAwareForeignKey\n \n class ChildModel(models.Model):\n parent = StorageAwareForeignKey(ParentModel, on_delete=models.CASCADE, count_as_storage_parent=True)\n ```\n\n- **Signal Integration**:\nEnsure the signals provided by Databyte are integrated to automatically update storage values on record save and delete events.\n\n## Contributing\nAs this is an open-source project hosted on GitHub, your contributions and improvements are welcome! Follow these general steps for contributing:\n\n1. **Fork the Repository**: \nStart by forking the main repository to your personal GitHub account.\n\n2. **Clone the Forked Repository**: \nClone your forked repository to your local machine.\n\n ```\n git clone https://github.com/YidiSprei/DjangoDatabyte.git\n ```\n\n3. **Create a New Branch**: \nBefore making any changes, create a new branch:\n\n ```\n git checkout -b feature-name\n ```\n\n4. **Make Your Changes**: \nImplement your features, enhancements, or bug fixes.\n\n5. **Commit & Push**:\n\n ```\n git add .\n git commit -m \"Descriptive commit message about changes\"\n git push origin feature-name\n ```\n \n6. **Create a Pull Request (PR)**: \nGo to your forked repository on GitHub and click the \"New Pull Request\" button. Make sure the base fork is the original repository, and the head fork is your repository and branch. Fill out the PR template with the necessary details.\n\nRemember to always be respectful and kind in all interactions with the community. It's all about learning, growing, and helping each other succeed!\n\n## Credits\nDeveloped with \ud83d\udc99 by Yidi Sprei. We thank all the contributors and the Django community for their support and inspiration.\n\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A Django app to help keep track of storage usage by records.",
"version": "1.3",
"project_urls": {
"Homepage": "https://github.com/YidiSprei/DjangoDatabyte.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9581361fbab19a28e690405046630a5790a9185838e38035758113e2ead1662a",
"md5": "8fed970a228828da7ab7514aa445cece",
"sha256": "6316d397c08b6980a1ba13c48543f0a782c73f290b78288239ef8153c58bea7c"
},
"downloads": -1,
"filename": "databyte-1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8fed970a228828da7ab7514aa445cece",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9696,
"upload_time": "2023-12-07T02:05:33",
"upload_time_iso_8601": "2023-12-07T02:05:33.619117Z",
"url": "https://files.pythonhosted.org/packages/95/81/361fbab19a28e690405046630a5790a9185838e38035758113e2ead1662a/databyte-1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9211d0ad5c135712fec39ff59ee91801541fd0fcab46ebb7055f55f7c05ce431",
"md5": "8d3897d1da952206f1d6d1b71fcf459c",
"sha256": "3456c98d53f6ea5cb2fc8e1159ebb5f2ce598a9a9103deec8777b0233ec6152b"
},
"downloads": -1,
"filename": "databyte-1.3.tar.gz",
"has_sig": false,
"md5_digest": "8d3897d1da952206f1d6d1b71fcf459c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9671,
"upload_time": "2023-12-07T02:05:35",
"upload_time_iso_8601": "2023-12-07T02:05:35.248727Z",
"url": "https://files.pythonhosted.org/packages/92/11/d0ad5c135712fec39ff59ee91801541fd0fcab46ebb7055f55f7c05ce431/databyte-1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-07 02:05:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "YidiSprei",
"github_project": "DjangoDatabyte",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "databyte"
}