identityfield
Auto-incrementing fields like Django AutoField but without restrictions!
This reusable app provides fields that are using PostgreSQL GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY.
Same as Django AutoField. But without primary_key=true limitation.
Installation
https://pypi.org/project/django-identityfield/
uv add django-identityfield- add
"identityfield"to yoursettings.INSTALLED_APPS
Usage
from django.db import models
from identityfield import IdentityField, Identity
class HappyModel(models.Model):
sequence = IdentityField()
# ALWAYS rejects any value other than DEFAULT in UPDATE
always_sequence = IdentityField(identity=Identity.ALWAYS)
DB sequences are automatically created by PostgreSQL. And are automatically incremented on DB side.
https://www.postgresql.org/docs/current/ddl-identity-columns.html
Running test suite
uv run pytest
uvx tox
Release files for django-identityfield 0.2.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 | |
|---|---|---|---|
| django_identityfield-0.2.0.tar.gz | 1.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_identityfield-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.8 kB
Release files / django_identityfield-0.2.0.tar.gz
| Download URL | django_identityfield-0.2.0.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e30a310992b8a51a49d67403e29633ef50158765246b4d7a00fb505cdb6d4bd
|
|
BLAKE2b-256 checksum How to use checksums |
92a925dfa51d1f1aa8f9951a4959f39e043ad371ee8c07990b8b68254df3b589
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|
Release files / django_identityfield-0.2.0-py3-none-any.whl
| Download URL | django_identityfield-0.2.0-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec9dd4e636bf52276f653ed2b2f97f433f66f7f7b4d9d63336dcba0477f9b48d
|
|
BLAKE2b-256 checksum How to use checksums |
2ccb498a0e355c96ba05f567475c74b9a01fb541c3d301ff3fd6fba360111c9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|