{"id":16209030,"url":"https://github.com/dhilipsiva/orm-choices","last_synced_at":"2025-11-09T10:03:18.429Z","repository":{"id":48354734,"uuid":"46913899","full_name":"dhilipsiva/orm-choices","owner":"dhilipsiva","description":"Helpful decorators + utils for choice fields (Django choices or SQLAlchemy ChoiceType). Do choices the pythonic way.","archived":false,"fork":false,"pushed_at":"2022-12-08T02:12:35.000Z","size":30,"stargazers_count":13,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-28T23:02:07.020Z","etag":null,"topics":["choice","choice-fields","decorators","django","django-choices","orm-choices","pythonic","sqlalchemy"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/orm-choices","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/dhilipsiva.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":"2015-11-26T08:32:12.000Z","updated_at":"2023-06-12T12:10:13.000Z","dependencies_parsed_at":"2023-01-24T05:00:32.578Z","dependency_job_id":null,"html_url":"https://github.com/dhilipsiva/orm-choices","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dhilipsiva/orm-choices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhilipsiva%2Form-choices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhilipsiva%2Form-choices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhilipsiva%2Form-choices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhilipsiva%2Form-choices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dhilipsiva","download_url":"https://codeload.github.com/dhilipsiva/orm-choices/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhilipsiva%2Form-choices/sbom","scorecard":{"id":340275,"data":{"date":"2025-08-11","repo":{"name":"github.com/dhilipsiva/orm-choices","commit":"e76391722bb761fa81402dcf0668eb0b93b486b3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/15 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"17 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-42986 / GHSA-43fp-rhv2-5gv8","Warn: Project is vulnerable to: PYSEC-2023-135 / GHSA-xqr8-7jwr-rhp7","Warn: Project is vulnerable to: PYSEC-2024-60 / GHSA-jjg7-2v4v-x38h","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2023-74 / GHSA-j8r2-6x86-q33q","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg","Warn: Project is vulnerable to: GHSA-g7vv-2v7x-gj9p","Warn: Project is vulnerable to: GHSA-34jh-p97f-mpxf","Warn: Project is vulnerable to: PYSEC-2023-212 / GHSA-g4mx-q9vg-27p4","Warn: Project is vulnerable to: PYSEC-2023-207 / GHSA-gwvm-45gx-3cf8","Warn: Project is vulnerable to: PYSEC-2019-133 / GHSA-mh33-7rrq-662w","Warn: Project is vulnerable to: GHSA-pq67-6m6q-mj2v","Warn: Project is vulnerable to: PYSEC-2019-132 / GHSA-r64q-w8jr-g9qp","Warn: Project is vulnerable to: PYSEC-2023-192 / GHSA-v845-jxx5-vc9f","Warn: Project is vulnerable to: PYSEC-2020-148 / GHSA-wqvq-5m8c-6g24","Warn: Project is vulnerable to: PYSEC-2021-108"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T05:38:03.241Z","repository_id":48354734,"created_at":"2025-08-18T05:38:03.242Z","updated_at":"2025-08-18T05:38:03.242Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278978908,"owners_count":26079370,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["choice","choice-fields","decorators","django","django-choices","orm-choices","pythonic","sqlalchemy"],"created_at":"2024-10-10T10:27:08.059Z","updated_at":"2025-10-08T16:36:36.431Z","avatar_url":"https://github.com/dhilipsiva.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ORM Choices\n\nHelpful decorators + utils for choice fields (Django choices or SQLAlchemy ChoiceType). Do choices the pythonic way.\n\n## Why create ORM Choices?\n\nI got sick and tired of using `choice` fields in Django ORM and SQLAlchemy. [Look here for a context](https://github.com/pythonindia/junction/issues/302)\n\nFor example:\n\n```python\n# Conference Application Choice Fields\nCONFERENCE_STATUS_ACCEPTING_CFP = \"Accepting Proposals\"\nCONFERENCE_STATUS_CLOSED_CFP = \"Proposal submission closed\"\nCONFERENCE_STATUS_ACCEPTING_VOTES = \"Accepting Votes\"\nCONFERENCE_STATUS_SCHEDULE_PUBLISHED = \"Schedule Published\"\n\nCONFERENCE_STATUS_LIST = ((1, CONFERENCE_STATUS_ACCEPTING_CFP),\n                          (2, CONFERENCE_STATUS_CLOSED_CFP),\n                          (3, CONFERENCE_STATUS_ACCEPTING_VOTES),\n                          (4, CONFERENCE_STATUS_SCHEDULE_PUBLISHED),\n                          )\n\n# Using it in a model:\n\nclass Conference(Model):\n    status = models.PositiveSmallIntegerField(\n\t\tdefault=1, choices=CONFERENCE_STATUS_LIST)\n```\n\nI have no Idea what 1 is (I mean its not really obvious that it means `CONFERENCE_STATUS_ACCEPTING_CFP` when `CONFERENCE_STATUS_LIST` is declared in some other file).\n\n\nI needed a clean and DRY way of making use of Choice Fields.\n\nIntroducing `choices`:\n\n\n```python\n\nfrom orm_choices import choices\n\n@choices\nclass ConferenceStatus:\n\tclass Meta:\n    \tACCEPTING_CFP = [1, \"Accepting Proposals\"]\n    \tCLOSED_CFP = [2, \"Proposal submission closed\"]\n    \tACCEPTING_VOTES = [3, \"Accepting Votes\"]\n    \tSCHEDULE_PUBLISHED = [4, \"Schedule Published\"]\n\n# Using it in a model:\n\nclass Conference(Model):\n    status = models.PositiveSmallIntegerField(\n\t\tdefault=ConferenceStatus.ACCEPTING_CFP,\n\t\tchoices=ConferenceStatus.CHOICES)\n```\n\nWhat did just happen? Crazy (not really). I know, right! Declare all your variables in `Meta` class (within `ConferenceStatus`). And apply the `orm_choices` decorator to `ConferenceStatus` class. And boom! Your `ConferenceStatus` now has these attributes:\n\n```python\nConferenceStatus.ACCEPTING_CFP  # This will return `1`\nConferenceStatus.ACCEPTING_VOTES  # This will return `2`\n\n# And so on...\n```\nAnd it will add a new `CHOICES` attribute too.\n\n```\nprint(ConferenceStatus.CHOICES)\n# Will Print\n((1, \"Accepting Proposals\"), (2, \"Proposal submission closed\"), (3, \"Accepting Votes\"), (4, \"Schedule Published\"))\n```\n\nClean and DRY!\n\n## Utils\n\n### Curreny Codes\n\n```python\nfrom orm_choices.utils.currency_code import CurrencyCode\n```\n\n### Blood Types\n\n```python\nfrom orm_choices.utils.blood_type import BloodType\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhilipsiva%2Form-choices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhilipsiva%2Form-choices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhilipsiva%2Form-choices/lists"}