Auto-incrementing fields like Django AutoField but without restrictions!
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_identityfield-0.1.2.tar.gz.
File metadata
- Download URL: django_identityfield-0.1.2.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.31
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f858b89db3e5343a69240fc274a53b77ce4a9c4a85c6fd037dd0e9ecadd023d6
|
|
| MD5 |
e23718a0584bf01e4adb7c8358a2e17c
|
|
| BLAKE2b-256 |
0cdb62ded8dfaf55437e63e2d8b5e72385eea05185b02bd92de78c6ba7756225
|
File details
Details for the file django_identityfield-0.1.2-py3-none-any.whl.
File metadata
- Download URL: django_identityfield-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.31
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71813ae2a2076cd2aeb7baa0b33f1dddd19205bbb5b971a35a2d3a917a77dafb
|
|
| MD5 |
d926c03984747d7ddb61b01516c7b49a
|
|
| BLAKE2b-256 |
884bb304a4b1863c277f48096106aed44a45b99a5941945bb3cfdc8fd23edc17
|