Skip to content

DLRSP/django-model-mixin

Repository files navigation

django-model-mixin PyPi license

PyPi status PyPi version PyPi python version PyPi downloads PyPi downloads PyPi downloads

GitHub GitHub release GitHub release

Test codecov.io pre-commit.ci status gitthub.com

Check Demo Project

  • Check the demo repo on GitHub

Requirements

  • Python 3.8+ supported.
  • Django 3.2+ supported.

Setup

  1. Install from pip:
pip install django-model-mixin
  1. Modify settings.py by adding the app to INSTALLED_APPS:
INSTALLED_APPS = [
    # ...
    "model_mixin",
    # ...
]
  1. Modify your project models.py with needed imports and class extends:
# ...other imports...
from model_mixin.models import AuditModelMixin, PublishModelMixin

class MyCustomClass(AuditModelMixin, PublishModelMixin):
    # ...
  1. Execute Django's command makemigrations inside your project's root:
python manage.py makemigrations
  1. 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

About

Django application provide simple model's mixins to add common reusable attributes.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages