django-prefixed-textinput
An extension of the default TextInput widget that displays a read-only string prefix over the input field.
Compatibility
The widget has been tested on all Python/Django version combinations officially supported by the Django project:
| Django 4.2 | 5.0 | 5.1 | 5.2 | |
|---|---|---|---|---|
| Python 3.8 | ✔ | |||
| 3.9 | ✔ | |||
| 3.10 | ✔ | ✔ | ✔ | ✔ |
| 3.11 | ✔ | ✔ | ✔ | ✔ |
| 3.12 | ✔ | ✔ | ✔ | ✔ |
| 3.13 | ✔ | ✔ | ||
| 3.14 | ✔ |
If you need to use django-prefixed-textinput with Django 3, please use a version of the package prior to 1.0.0.
Styling for the widget includes support for right-to-left (RTL) languages so this should work more or less as expected. Note that IE11 is not supported as the widget styling requires support for CSS Custom Properties ("CSS Variables").
Installation
$ pip install django-prefixed-textinput
Usage
Add prefixed_textinput to your INSTALLED_APPS setting:
INSTALLED_APPS = [
# ...
'prefixed_textinput',
]
Import the widget:
from prefixed_textinput import PrefixedTextInput
Define a custom admin form, which allows overriding the widget for a specific field:
# forms.py
from django import forms
from prefixed_textinput import PrefixedTextInput
class MyModelAdminForm(forms.ModelForm):
class Meta:
widgets = {
'myfield':
PrefixedTextInput(prefix='FOO'),
}
fields = '__all__'
Specify the custom admin form in your admin definition:
# admin.py
from django import admin
from .forms import MyModelAdminForm
from .models import MyModel
@admin.register(MyModel)
class ProductAdmin(admin.ModelAdmin):
form = MyModelAdminForm
Development
If working locally on the package you can install the development tools via pip:
$ pip install -e .[dev]
Run the bundled Django example project:
$ cd example_project
$ python manage.py migrate
$ python manage.py createsuperuser
$ python manage.py runserver 0.0.0.0:8000
$ open http://localhost:8000/admin/
Navigate to the example Book model in the Bookshop app to see the widget in action.
Run the extremely basic test suite across environments using tox:
$ tox run
Issues, Suggestions, Contributions
...are welcome on GitHub. Thanks for your interest in django-prefixed-textinput!
Metadata
Release files for django-prefixed-textinput 1.0.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 | Provenance | Actions |
|---|---|---|---|---|
| django_prefixed_textinput-1.0.2.tar.gz | 8.9 kB | Without provenance | Details for django_prefixed_textinput-1.0.2.tar.gz |
Release files / django_prefixed_textinput-1.0.2.tar.gz
| Download URL | django_prefixed_textinput-1.0.2.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c88f66454d1aa7cb518b100b96647e663854a06f737114c3a7ced3d7d2c7ce92
|
|
BLAKE2b-256 checksum How to use checksums |
cf8f5bc42d1dcdfc84444130014d5f763ab26adb66eecc7c5a3f6d321ab484b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for django-prefixed-textinput 1.0.2
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.