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.2.tar.gz
(118.2 kB
view hashes)
Built Distribution
Close
Hashes for django_model_mixin-0.3.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a52f35ec63563881fb924fd008318ea08e552a587f6eca62b3fe0dbd3a4e96c |
|
MD5 | 08e33e99fdb985ed62d0dc930d03c344 |
|
BLAKE2b-256 | 809c2894bfe39709c0162aea184ad058ac55698315482e007100f4a2444f2591 |