Skip to main content

No project description provided

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

  • uv add django-identityfield
  • add "identityfield" to your settings.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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_identityfield-0.1.1.tar.gz (1.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_identityfield-0.1.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file django_identityfield-0.1.1.tar.gz.

File metadata

File hashes

Hashes for django_identityfield-0.1.1.tar.gz
Algorithm Hash digest
SHA256 36b05b75042607a5a4e6a42d2a46087d64c19a4258af75604e8b1e6a4f22b069
MD5 72b13ef4c2aa46678199598bbcda6d68
BLAKE2b-256 9b3722f8de88765932124eedbcd996541d43708b1ed73e348ca4e591e4ef5ccb

See more details on using hashes here.

File details

Details for the file django_identityfield-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_identityfield-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2d85d525cab9d494c287c8a3725f47991d2ecc16b34212d8c719aeb761dea1d
MD5 b951c33ae5f2deb5ea74c7457904487a
BLAKE2b-256 6d2dc42e2b47f528f8c1702113c78e24f5c72065fbe1521652c8742fcf95f741

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page