Skip to main content

django-postgres-setfield

https://travis-ci.org/CodeYellowBV/django-postgres-setfield.svg?branch=master

A Django field for storing standard Python set objects. It uses Postgres arrays as a backing store.

Usage

Using the field is straightforward, and similar to how you’d use a Django ArrayField. You can add the field to your model like so:

from django.db import models
from setfield import SetField

class Person(models.Model):
  LANGUAGES = (('NL', 'Dutch'), ('EN', 'English'), ('RU', 'Russian'))
  speaks_languages=SetField(models.TextField(choices=LANGUAGES), default=list, blank=True)

Then later, you can use it:

piet = Person(languages={'NL'})
piet.save()

john = Person(languages={'RU', 'EN'})
john.save()

Lookups

All the standard Django ArrayField lookups are supported.

Caveats

  • Unlike ArrayFields, SetFields cannot be nested (because sets cannot be nested in Python).

  • When upgrading an existing ArrayField to a SetField, make sure the entries are sorted using the default sort order of Python for the corresponding object type, if you want to use the __exact lookup. Otherwise you’ll get inconsistent results.

Metadata

Release files for django-postgres-setfield 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-postgres-setfield 0.0.1
File Size Uploaded Provenance Actions
django-postgres-setfield-0.0.1.tar.gz 5.4 kB Without provenance Details for django-postgres-setfield-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-postgres-setfield 0.0.1
File Interpreter ABI Platform Actions
django_postgres_setfield-0.0.1-py3-none-any.whl Python 3 none any Details for django_postgres_setfield-0.0.1-py3-none-any.whl

Total release size: 12.2 kB

Release files / django-postgres-setfield-0.0.1.tar.gz

Download URL django-postgres-setfield-0.0.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
99041c82ead927d0e28a5f154fcf99c4666600314780cd8c8adbe061f33eb923
BLAKE2b-256 checksum
How to use checksums
216e0cd82e751d29296c72da6e5fc690de84cff6bf6f1318cc086bc590335c2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3

Release files / django_postgres_setfield-0.0.1-py3-none-any.whl

Download URL django_postgres_setfield-0.0.1-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7d17ae5405933e65415baf6c4a2cf1f2d62ccf1281d807eed3b1e87d3c73740
BLAKE2b-256 checksum
How to use checksums
d6ba034bacda17cdae5af5f1f963bc95ab796e8340abd0c85c8da89d8606c733
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3

Security for django-postgres-setfield 0.0.1

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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page