--- id: django-crum version: "0.7.9" license: BSD license_treatment: permissive maintenance: dormant --- # django-crum — Django middleware to capture current request and user. License: permissive · Maintenance: dormant · Downloads: 441.3K/mo ## What it is and what it does Django-CRUM is a middleware package that captures the current HTTP request and authenticated user into thread-local storage, allowing your code to access them anywhere in your application without threading the request object through function calls. It's particularly useful for audit logging, permission checks, and other cross-cutting concerns that need to know who made the current request. The package includes a context manager for temporarily impersonating another user and exposes a signal to customize how the current user is determined, which can help when using custom authentication methods or non-standard user models. It depends only on django and installs as a simple wheel with no compiled dependencies. Use it for: - Audit logging: capture which user performed an action without passing request through every function layer - Permission checks: verify user permissions in business logic without request object available - Temporary user impersonation: switch context to another user for a specific operation block - Custom authentication: extend the current-user detection via signals for non-standard auth backends ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Django-CRUM stores the current request and user in thread-local storage, making them accessible throughout your application without passing the request object explicitly. Yes, if you are on Django versions up to 3.1 and do not need active maintenance. The package is stable and lightweight for its intended use case, but dormant since 2020 means no support for newer Django releases. Install only if your project's Django version is within the tested range and you accept that updates will not arrive. ## Install pip install django-crum uv add django-crum poetry add django-crum ## Installing django-crum Before you install: Low install friction with a single dependency on django. Maintenance is dormant—last release was 2020-11-10 with no commits since 2024-02-22—so expect no active bug fixes or updates. License in practice: BSD license (permissive) places no restrictions on use, modification, or distribution in your own projects. Quickstart: pip install django-crum # In Django settings.py, add to MIDDLEWARE: # 'crum.CurrentRequestUserMiddleware' from crum import get_current_user user = get_current_user() Requires django as a runtime dependency; thread-local storage behavior in async contexts is not documented in the fact sheet. Verify before relying: - Whether the package works reliably with Django versions released after 2020-11-10 - Current behavior and support status in async Django contexts - Whether the custom user model signal extension works with all modern Django authentication backends ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 441.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django current request middleware, thread local request storage, django user context access, capture current user django, request context middleware, django audit trail user, thread local user storage, django-middleware, thread-local-storage, audit-logging [View on SkillFed](https://skillfed.io/packages/django-crum) · [View on PyPI](https://pypi.org/project/django-crum/)