https://github.com/dlrsp/django-model-mixin
Django application provide simple model's mixins to add common reusable attributes.
https://github.com/dlrsp/django-model-mixin
Last synced: 11 months ago
JSON representation
Django application provide simple model's mixins to add common reusable attributes.
- Host: GitHub
- URL: https://github.com/dlrsp/django-model-mixin
- Owner: DLRSP
- License: mit
- Created: 2023-10-08T13:51:25.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-07T14:30:20.000Z (about 1 year ago)
- Last Synced: 2025-07-29T12:43:12.414Z (11 months ago)
- Language: Python
- Size: 348 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# django-model-mixin [](https://pypi.python.org/pypi/django-model-mixin)
[](https://pypi.python.org/pypi/django-model-mixin)
[](https://pypi.python.org/pypi/django-model-mixin)
[](https://pypi.python.org/pypi/django-model-mixin)
[](https://pypi.python.org/pypi/django-model-mixin)
[](https://pypi.python.org/pypi/django-model-mixin)
[](https://pypi.python.org/pypi/django-model-mixin)
## GitHub  
## Test [](https://codecov.io/github/DLRSP/django-model-mixin?branch=main) [](https://results.pre-commit.ci/latest/github/DLRSP/django-model-mixin/main) [](https://github.com/DLRSP/django-model-mixin/actions/workflows/ci.yaml)
## Check Demo Project
* Check the demo repo on [GitHub](https://github.com/DLRSP/example/tree/django-model-mixin)
## Requirements
- Python 3.8+ supported.
- Django 3.2+ supported.
## Setup
1. Install from **pip**:
```shell
pip install django-model-mixin
```
2. Modify `settings.py` by adding the app to `INSTALLED_APPS`:
```python
INSTALLED_APPS = [
# ...
"model_mixin",
# ...
]
```
3. Modify your project `models.py` with needed imports and class extends:
```python
# ...other imports...
from model_mixin.models import AuditModelMixin, PublishModelMixin
class MyCustomClass(AuditModelMixin, PublishModelMixin):
# ...
```
4. Execute Django's command `makemigrations` inside your project's root:
```shell
python manage.py makemigrations
```
5. Finally, execute Django's command `migrate` inside your project's root:
```shell
python manage.py migrate
```
## Run Example Project
```shell
git clone --depth=50 --branch=django-model-mixin https://github.com/DLRSP/example.git DLRSP/example
cd DLRSP/example
python manage.py runserver
```
Now browser the app @ http://127.0.0.1:8000