{"id":13813407,"url":"https://github.com/anentropic/django-exclusivebooleanfield","last_synced_at":"2025-05-15T00:33:03.916Z","repository":{"id":57419970,"uuid":"18762211","full_name":"anentropic/django-exclusivebooleanfield","owner":"anentropic","description":"Provides an ExclusiveBooleanField which is a boolean (database) field where only one row in the table (or optionally, a subset of rows based on value of other fields) is True and all the other rows are False.","archived":false,"fork":false,"pushed_at":"2016-06-28T15:01:07.000Z","size":42,"stargazers_count":24,"open_issues_count":3,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-09T21:43:34.314Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/anentropic.png","metadata":{"files":{"readme":"README.md","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":"2014-04-14T13:48:24.000Z","updated_at":"2022-10-21T04:55:13.000Z","dependencies_parsed_at":"2022-09-04T17:31:20.377Z","dependency_job_id":null,"html_url":"https://github.com/anentropic/django-exclusivebooleanfield","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anentropic%2Fdjango-exclusivebooleanfield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anentropic%2Fdjango-exclusivebooleanfield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anentropic%2Fdjango-exclusivebooleanfield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anentropic%2Fdjango-exclusivebooleanfield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anentropic","download_url":"https://codeload.github.com/anentropic/django-exclusivebooleanfield/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225319220,"owners_count":17455727,"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-08-04T04:01:16.763Z","updated_at":"2024-11-19T08:30:30.963Z","avatar_url":"https://github.com/anentropic.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"django-exclusivebooleanfield\n============================\n\n[![Build Status](https://travis-ci.org/anentropic/django-exclusivebooleanfield.svg?branch=master)](https://travis-ci.org/anentropic/django-exclusivebooleanfield)\n[![Latest PyPI version](https://badge.fury.io/py/django-exclusivebooleanfield.svg)](https://pypi.python.org/pypi/django-exclusivebooleanfield/)  \n![Tested for: Python 2.6](https://img.shields.io/badge/Python%202.6--brightgreen.svg)\n![Tested for: Python 2.7](https://img.shields.io/badge/Python%202.7--brightgreen.svg)\n![Tested for: Python 3.4](https://img.shields.io/badge/Python%203.4--brightgreen.svg)  \n![Tested for: Django 1.3](https://img.shields.io/badge/Django%201.3--brightgreen.svg)\n![Tested for: Django 1.4](https://img.shields.io/badge/Django%201.4--brightgreen.svg)\n![Tested for: Django 1.5](https://img.shields.io/badge/Django%201.5--brightgreen.svg)\n![Tested for: Django 1.6](https://img.shields.io/badge/Django%201.6--brightgreen.svg)\n![Tested for: Django 1.7](https://img.shields.io/badge/Django%201.7--brightgreen.svg)\n![Tested for: Django 1.8](https://img.shields.io/badge/Django%201.8--brightgreen.svg)\n\n\nProvides an `ExclusiveBooleanField` which is a boolean (db) field where only one row in the table (or optionally, a subset of table based on value of other fields) is `True` and all the other rows are `False`.\n\nUsage:\n```python\nfrom django.db import models\n\nfrom exclusivebooleanfield.fields import ExclusiveBooleanField\n\n\nclass MyModel(models.Model):\n    the_one = ExclusiveBooleanField()\n\n\nclass MyModel(models.Model):\n    field_1 = ForeignKey()\n    field_2 = CharField()\n    the_one = ExclusiveBooleanField(on=('field_1', 'field_2'))\n    # `on` is a bit like a unique constraint, value of field\n    # is only exclusive for rows with same value of the on fields\n\n\nclass MyOtherModel(models.Model):\n    field_1 = CharField()\n    the_one = ExclusiveBooleanField(on='field_1')\n    # if `on` is just a single field you don't have to wrap in a tuple\n```\n\nTested on Django 1.3 thru 1.8, to run tests checkout the project and `python setup.py test`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanentropic%2Fdjango-exclusivebooleanfield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanentropic%2Fdjango-exclusivebooleanfield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanentropic%2Fdjango-exclusivebooleanfield/lists"}