Utilities for DBCA Django apps
Project description
Overview
DBCA Django utility classes and functions.
Development
The recommended way to set up this project for development is using
uv
to install and manage a Python virtual environment.
With uv installed, install the required Python version (see pyproject.toml
). Example:
uv python install 3.12
Change into the project directory and run:
uv python pin 3.12
uv sync
Activate the virtualenv like so:
source .venv/bin/activate
Run unit tests using pytest
(or tox
, to test against multiple Python versions):
pytest -sv
tox -v
Releases
Tagged releases are built and pushed to PyPI automatically using a GitHub
workflow in the project. Update the project version in pyproject.toml
and
tag the required commit with the same value to trigger a release. Packages
can also be built and uploaded manually, if desired.
Build the project locally using uv, publish to the PyPI registry using the same tool if you require:
uv build
uv publish
Installation
- Install via pip/etc.:
pip install dbca-utils
SSO Login Middleware
This will automatically login and create users using headers from an upstream proxy (REMOTE_USER and some others). The logout view will redirect to a separate logout page which clears the SSO session.
Usage
Add dbca_utils.middleware.SSOLoginMiddleware
to settings.MIDDLEWARE
(after both of
django.contrib.sessions.middleware.SessionMiddleware
and
django.contrib.auth.middleware.AuthenticationMiddleware
.
Ensure that AUTHENTICATION_BACKENDS
contains django.contrib.auth.backends.ModelBackend
,
as this middleware depends on it for retrieving the logged in user for a session.
Note that the middleware will still work without it, but will reauthenticate the session
on every request, and request.user.is_authenticated
won't work properly/will be false.
Example:
MIDDLEWARE = [
...,
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'dbca_utils.middleware.SSOLoginMiddleware'
...,
]
Audit model mixin
AuditMixin
is an extension of Django.db.model.Model
that adds a number of additional fields:
creator
- FK toAUTH_USER_MODEL
, used to record the object creatormodifier
- FK toAUTH_USER_MODEL
, used to record who the object was last modified bycreated
- a timestamp that is set on initial object savemodified
- an auto-updating timestamp (on each object save)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dbca_utils-2.1.3.tar.gz
.
File metadata
- Download URL: dbca_utils-2.1.3.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
df6df447e47e7c48096092b2253059d154bbc9972447385ed3834824062d7ccc
|
|
MD5 |
cd7779d6eb6e9f365f3d52e54e277667
|
|
BLAKE2b-256 |
dc3776149410ba40f3f63bf84eb065257bab3afebf114981a1c788829436d7b6
|
File details
Details for the file dbca_utils-2.1.3-py3-none-any.whl
.
File metadata
- Download URL: dbca_utils-2.1.3-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
11e0ed30e07428f408b653e3b0f998badcf83a8bdd1e4d88da616eae637bd626
|
|
MD5 |
9f7a72510af0d00132b8ac57fcf93e37
|
|
BLAKE2b-256 |
f6bae1b5fe813dc6c8589d9f6530d6bac16c4f2cb3059d33c26899dd5c8dc9b6
|