django-puid
A Django field that generates human-friendly prefixed unique IDs — a readable alternative to UUIDs.
acct_lrjk8xr7z91mk # Stripe-style IDs
cus_lrjk8xq2a3b9f # instantly self-describing
post_4kp2mzn8q1vx # readable in logs, URLs, and support tickets
IDs are time-sortable (timestamp in base36) with a cryptographically random suffix, so they're both friendly and collision-resistant.
Installation
pip install django-puid
Quick Start
from django_puid.fields import PrefixedUIDField
class Customer(models.Model):
uid = PrefixedUIDField(prefix="cus")
The uid field auto-generates on save. It sits alongside Django's default integer primary key — it doesn't replace it.
Why Not UUID?
| UUID | django-puid | |
|---|---|---|
| Readable in logs | ❌ | ✅ |
| Self-describing in URLs | ❌ | ✅ |
| Easy to copy in support tickets | ❌ | ✅ |
| Time-sortable | ❌ | ✅ |
| Collision-resistant | ✅ | ✅ |
UUIDs are collision-resistant but opaque. f47ac10b-58cc-4372-a567-0e02b2c3d479 tells you nothing at a glance. Prefixed IDs are just as safe — and immediately meaningful.
# UUID
customer_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
# django-puid
customer_id = "cus_lrjk8xq2a3b9f"
Options
| Parameter | Default | Description |
|---|---|---|
prefix |
required | String prepended to the ID |
separator |
"_" |
Character between prefix and ID body |
random_length |
6 |
Number of random characters in the suffix |
Django Admin
The field is non-editable by default. To display it in the admin as read-only:
from django.contrib import admin
@admin.register(Customer)
class CustomerAdmin(admin.ModelAdmin):
readonly_fields = ["uid"]
License
MIT
Metadata
Release files for django-puid 0.1.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_puid-0.1.2.tar.gz | 4.6 kB | Without provenance | Details for django_puid-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_puid-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for django_puid-0.1.2-py3-none-any.whl |
Total release size: 8.9 kB
Release files / django_puid-0.1.2.tar.gz
| Download URL | django_puid-0.1.2.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e947c503c7e5ce5944ede720a241fa3819be0186b2e35c91e6c171b868ac0ad
|
|
BLAKE2b-256 checksum How to use checksums |
410eda69a818b1878023d04e5d52244b1eb2fd67aca6643cdaecabe12171ff95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / django_puid-0.1.2-py3-none-any.whl
| Download URL | django_puid-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ceab82fbc28878d707c8aa527e4c597e7f1ab769b9602ea79143c0d3d6697e5
|
|
BLAKE2b-256 checksum How to use checksums |
9b4af4ecf35b19ffc9bf8e52ae61104b48b5f9cab6948409d02dd4693f2cd7e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for django-puid 0.1.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.