Django application provide simple model's mixins to add common reusable attributes.
Project description
django-model-mixin
GitHub
Test
Check Demo Project
- Check the demo repo on GitHub
Requirements
- Python 3.8+ supported.
- Django 3.2+ supported.
Setup
- Install from pip:
pip install django-model-mixin
- Modify
settings.py
by adding the app toINSTALLED_APPS
:
INSTALLED_APPS = [
# ...
"model_mixin",
# ...
]
- Modify your project
models.py
with needed imports and class extends:
# ...other imports...
from model_mixin.models import AuditModelMixin, PublishModelMixin
class MyCustomClass(AuditModelMixin, PublishModelMixin):
# ...
- Execute Django's command
makemigrations
inside your project's root:
python manage.py makemigrations
- Finally, execute Django's command
migrate
inside your project's root:
python manage.py migrate
Run Example Project
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-model-mixin-0.3.3.tar.gz
(16.7 kB
view details)
Built Distribution
File details
Details for the file django-model-mixin-0.3.3.tar.gz
.
File metadata
- Download URL: django-model-mixin-0.3.3.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71b6b8f1f53c990b26adacf10c50b96344eb6fed2c74ddc18c3cab855bba1f8a |
|
MD5 | 64b037351b12dae9eca27f08e00b5c55 |
|
BLAKE2b-256 | 9782482cd510577c7cf9d0e589beaba17ed466249ca6960cb8b2256df0d27872 |
File details
Details for the file django_model_mixin-0.3.3-py2.py3-none-any.whl
.
File metadata
- Download URL: django_model_mixin-0.3.3-py2.py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1da66ead6b94fad5ab88dca47ba1b5e38ec5c53797583a2cf73bebdf51babca0 |
|
MD5 | 5c67c623c29fb87cd84393732cdd532f |
|
BLAKE2b-256 | 821a303a2ed8a951dd413f898f1a39579b182fd3225d127a1230f00dd356df21 |