About
A reusable DRF library that provides reusable components.
Installation
pip install django-pycorpkit
Quick start
Add “django-pycorpkit” to your INSTALLED_APPS setting:
INSTALLED_APPS = [ ... "pycorpkit.common", "pycorpkit.accountx", "pycorpkit.org_structure", ]Include the django_sample_lib URLconf in your project urls.py:
path('api/', include('pycorpkit.urls')),Run migrations:
python manage.py migrateAdd exception handler and default backend filter:
REST_FRAMEWORK = { "EXCEPTION_HANDLER": "pycorpkit.common.utils.exception_handler.custom_exception_handler", "DEFAULT_PERMISSION_CLASSES": [ "pycorpkit.accountx.permissions.enforce.EnforceDRFViewPermission", ], "DEFAULT_FILTER_BACKENDS": ( "pycorpkit.common.filters.base.OrganisationFilterBackend", ), }Add required variables in settings file:
PERMISSIONS_PATH = "testapp.perms" APP_NAME = "PyCorpKit" CLIENT_DOMAIN = "http://domain.com/" AUTH_USER_MODEL = "accountx.User" DEFAULT_FROM_EMAIL = "admin@example.com" SIMPLE_JWT = { "ACCESS_TOKEN_LIFETIME": timedelta(seconds=3600), "REFRESH_TOKEN_LIFETIME": timedelta(days=7), }INCLUDE django_rest_passwordreset in installed apps
INSTALLED_APPS = ( 'django_rest_passwordreset', )Add PhoneModelBackend to AUTHENTICATION_BACKENDS
AUTHENTICATION_BACKENDS = [ 'django.contrib.auth.backends.ModelBackend', # add the below after `ModelBackend` 'pycorpkit.common.utils.phone_backend.PhoneModelBackend', ]Add organisation middleware
MIDDLEWARE = [ "pycorpkit.common.utils.middleware.OrganisationIDMiddleware", ]Define DEFAULT_ROLES in settings
DEFAULT_ROLES = { "Organisation Admin": ORGANISATION_ADMIN, "Branch Admin": BRANCH_ADMIN, "Department Admin": DEPARTMENT_ADMIN, "User": PROFILE_ADMIN, }
Development
To set up the development environment:
Clone the repository
Create a virtual environment and activate it
Install development dependencies:
pip install -e ".[dev]"Run tests:
python -m pytest tests # OR pytest tests/
Install test dependencies
pip install -e ".[test]"
Making migrations
python testapp/manage.py makemigrations
python testapp/manage.py makemigrations <app_name> --empty
Migrate
python testapp/manage.py migrate
Metadata
Release files for django-pycorpkit 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_pycorpkit-1.0.4.tar.gz | 70.8 kB | Without provenance | Details for django_pycorpkit-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_pycorpkit-1.0.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for django_pycorpkit-1.0.4-py2.py3-none-any.whl |
Total release size: 140.0 kB
Release files / django_pycorpkit-1.0.4.tar.gz
| Download URL | django_pycorpkit-1.0.4.tar.gz |
|---|---|
| Size | 70.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8079d83c17914e86feb6c49373c9b5bb8c1035500967dc620848db4ac57e672b
|
|
BLAKE2b-256 checksum How to use checksums |
a08adacaeb97ed74ae1df17ac56be1fdcd58b973ecb9b53022afea40e074b6c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Release files / django_pycorpkit-1.0.4-py2.py3-none-any.whl
| Download URL | django_pycorpkit-1.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 69.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1bdb7babb724cec2d60892271a78620e00baae91f24bdf7f75275d81d6eba2fe
|
|
BLAKE2b-256 checksum How to use checksums |
41e2da1a2bb220ea4c20a45ab4d78278297c000e9b657811919922a1639b0428
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Security for django-pycorpkit 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.