{"id":20525978,"url":"https://github.com/codeyellowbv/django-postgres-setfield","last_synced_at":"2025-10-20T00:07:50.263Z","repository":{"id":57421309,"uuid":"222886856","full_name":"CodeYellowBV/django-postgres-setfield","owner":"CodeYellowBV","description":"Django field plugin for sets, backed by array storage in PostgreSQL","archived":false,"fork":false,"pushed_at":"2022-09-16T02:48:17.000Z","size":16,"stargazers_count":3,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-14T10:02:05.092Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeYellowBV.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-20T08:23:39.000Z","updated_at":"2024-08-27T16:38:51.000Z","dependencies_parsed_at":"2022-09-14T08:40:51.925Z","dependency_job_id":null,"html_url":"https://github.com/CodeYellowBV/django-postgres-setfield","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/CodeYellowBV/django-postgres-setfield","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeYellowBV%2Fdjango-postgres-setfield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeYellowBV%2Fdjango-postgres-setfield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeYellowBV%2Fdjango-postgres-setfield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeYellowBV%2Fdjango-postgres-setfield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeYellowBV","download_url":"https://codeload.github.com/CodeYellowBV/django-postgres-setfield/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeYellowBV%2Fdjango-postgres-setfield/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260307950,"owners_count":22989802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T23:11:40.296Z","updated_at":"2025-10-20T00:07:45.222Z","avatar_url":"https://github.com/CodeYellowBV.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-postgres-setfield\n========================\n\n.. image:: https://travis-ci.org/CodeYellowBV/django-postgres-setfield.svg?branch=master\n   :target: https://travis-ci.org/CodeYellowBV/django-postgres-setfield\n\nA Django field for storing `standard Python set \u003chttps://docs.python.org/3/library/stdtypes.html#set-types-set-frozenset\u003e`_\nobjects.  It uses Postgres arrays as a backing store.\n\nUsage\n-----\n\nUsing the field is straightforward, and similar to how you'd use a\n`Django ArrayField \u003chttps://docs.djangoproject.com/en/2.1/ref/contrib/postgres/fields/\u003e`_.\nYou can add the field to your model like so:\n\n.. code:: python\n\n    from django.db import models\n    from setfield import SetField\n\n    class Person(models.Model):\n      LANGUAGES = (('NL', 'Dutch'), ('EN', 'English'), ('RU', 'Russian'))\n      speaks_languages=SetField(models.TextField(choices=LANGUAGES), default=list, blank=True)\n\nThen later, you can use it:\n\n.. code:: python\n\n    piet = Person(languages={'NL'})\n    piet.save()\n\n    john = Person(languages={'RU', 'EN'})\n    john.save()\n\n\nLookups\n-------\n\nAll the standard `Django ArrayField`_ lookups are supported.\n\n\nCaveats\n-------\n\n* Unlike ArrayFields, SetFields cannot be nested (because sets cannot\n  be nested in Python).\n* When upgrading an existing ArrayField to a SetField, make sure the\n  entries are sorted using the default sort order of Python for the\n  corresponding object type, if you want to use the ``__exact``\n  lookup.  Otherwise you'll get inconsistent results.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeyellowbv%2Fdjango-postgres-setfield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeyellowbv%2Fdjango-postgres-setfield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeyellowbv%2Fdjango-postgres-setfield/lists"}