User Language Middleware
What’s this?
This package contains a middleware that activates translations based on the language field in the user model. This enables easy user-specific localization of a Django application: just add a language string field to the user model, install this middleware and you’re good to go!
Usage
Add a language field to your user model:
class User(auth_base.AbstractBaseUser, auth.PermissionsMixin):
# ...
language = models.CharField(max_length=10,
choices=settings.LANGUAGES,
default=settings.LANGUAGE_CODE)
Install the middleware from pip:
pip install django-user-language-middleware
and then add it to your middleware class list to listen to requests:
MIDDLEWARE = [ # Or MIDDLEWARE_CLASSES on Django < 1.10
...
'user_language_middleware.UserLanguageMiddleware',
...
]
Supported versions
Python:
2.7
3.4 to 3.6
Django:
1.8 to 1.11
2.0
Metadata
Release files for django-user-language-middleware 0.0.3
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-user-language-middleware-0.0.3.tar.gz | 2.9 kB | Without provenance | Details for django-user-language-middleware-0.0.3.tar.gz |
Release files / django-user-language-middleware-0.0.3.tar.gz
| Download URL | django-user-language-middleware-0.0.3.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c73a0d5916aa07810bf32d8b6be4f0b66d5486126ee5b21d1dee638b80763d2
|
|
BLAKE2b-256 checksum How to use checksums |
adebdcf9926f15e5c6488bbc139c7ef923ba027351a3dfc72f18ac5725a4f586
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/2.7.15rc1
|
Security for django-user-language-middleware 0.0.3
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.