python-ulid-django
ULID (Universally Unique Lexicographically Sortable Identifier) support for Django.
This package uses the ULID type implemented by python-ulid.
This package is heavily inspired by
django-ulid. The reason I'm reinventing the wheel is that I want to usepython-ulid's ULID implementation.
Requirements
Python 3.12+ and Django 5.2+.
Usage
Installation
pip install python-ulid-django
Model Field
You can then add ULIDField to your Django model just like other fields.
Example:
from django.contrib.auth.models import AbstractUser
from ulid import ULID
from ulid_django.models import ULIDField
class User(AbstractUser):
id = ULIDField(primary_key=True, default=ULID, editable=False)
Form Field
ULIDField supplies a matching form field automatically, so a ModelForm needs
no extra wiring. Use it directly when building a plain form:
from django import forms
from ulid_django.forms import ULIDField
class LookupForm(forms.Form):
item_id = ULIDField()
It cleans to a ULID and accepts three input widths: the 26-character canonical
representation, a 32-character hex string, and a 36-character UUID string.
URL Converter
A URL converter is also provided.
from django.urls import path, register_converter
from ulid import ULID
from ulid_django.converters import ULIDConverter
def user_detail_view(request, user_id):
assert isinstance(user_id, ULID)
...
register_converter(ULIDConverter, "ulid")
urlpatterns = [
path("user/<ulid:user_id>/", user_detail_view),
...,
]
Development
Environment setup: just dev-setup
Run linters: just lint
Test: just test
Test against every supported Python version: just test-all
Metadata
Release files for python-ulid-django 1.6.0
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 |
|---|---|---|---|---|
| python_ulid_django-1.6.0.tar.gz | 5.6 kB | Without provenance | Details for python_ulid_django-1.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_ulid_django-1.6.0-py3-none-any.whl | Python 3 | none | any | Details for python_ulid_django-1.6.0-py3-none-any.whl |
Total release size: 11.8 kB
Release files / python_ulid_django-1.6.0.tar.gz
| Download URL | python_ulid_django-1.6.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a07efbda370703ed12500593acc3cb76df067f824297866f6dc808c755a718ac
|
|
BLAKE2b-256 checksum How to use checksums |
47297ad88c102e26063b8651bff6fa87eb422be95177bf7502134c1515cc7cae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / python_ulid_django-1.6.0-py3-none-any.whl
| Download URL | python_ulid_django-1.6.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0070887ca482992e2045280910e161ae7cfc604334ba634d9abc20014b0a9677
|
|
BLAKE2b-256 checksum How to use checksums |
3cc4b5a83655d6ab478f1d36d5583c83910f6dbe86963385765592e2f1d416dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for python-ulid-django 1.6.0
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.