django-fullname-localization
Add localization support for user's fullname.
Install
pip install django-fullname-localization
Settings
pro/settings.py
INSTALLED_APPS = [
...
'django_fullname_localization',
...
]
USE_FULL_NAME_INSTEAD_OF_SHORT_NAME = True
FULL_NAME_TEMPLATE = "{user.last_name}{user.first_name}"
Note:
- At django_fullname_localization app ready step, we override AbstractUser.get_full_name method, so that all user model that inherit from AbstractUser will get a new *.get_full_name() method.
- Use FULL_NAME_TEMPLATE to define your fullname style.
- USE_FULL_NAME_INSTEAD_OF_SHORT_NAME defaults to True, so that the short name will be replaced with our full name. Mostly our full name is short enough ^_^
Fullname template setting
FULL_NAME_TEMPLATE default to "{user.last_name}{user.first_name}", it's our default name format ^_^.
Notes:
- If using default User model, you can use user.first_name and user.last_name parameter to write your own template.
- If using customer model that has more name parts, you can using parameter {user.your_own_field}.
- Some application that doesn't override the default User model but keep the full name in first_name and keep the last name in last_name, so that you just set FULL_NAME_TEMPLATE="{user.first_name}".
Usage
app/template/demo.html
{{request.user.get_full_name}}
app/views.py
def page(request):
...
fullname = request.user.get_full_name()
...
Release
v0.1.0 2020/02/29
- First release.
v0.2.0 2020/09/09
- Add license in package.
- Add replacing short name with full name support. It is controlled by USE_FULL_NAME_INSTEAD_OF_SHORT_NAME option in settings. USE_FULL_NAME_INSTEAD_OF_SHORT_NAME defaults to True, so that the name used in the default django's admin site topbar will be our full name.
- Remove first_name, last_name parameter support for FULL_NAME_TEMPLATE, for user's customized User Model may not have first_name, last_name fields.
- Fix documentations.
v0.2.1 2023/09/15
- Doc update.
v0.2.2 2025/10/18
- Doc update.
Metadata
Release files for django-fullname-localization 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_fullname_localization-0.2.2.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_fullname_localization-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / django_fullname_localization-0.2.2.tar.gz
| Download URL | django_fullname_localization-0.2.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f0bd74536951dd9535a72dbecf25eb61abe3ebaf4fd14649d44f86f6a9ff52a
|
|
BLAKE2b-256 checksum How to use checksums |
849cbb33d16600df59ddc8f5c0a03835b7ac96bc3d0fac57407bf7af01d631eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Release files / django_fullname_localization-0.2.2-py3-none-any.whl
| Download URL | django_fullname_localization-0.2.2-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea09393355b1405de388a7378fdd76273eaccb32cbf6c8ec4fdb2c371c36f546
|
|
BLAKE2b-256 checksum How to use checksums |
8f42dbeb19e8fe9a9cfff8a580a39c025681b48ce556d1cccfe1e75668d165c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|