{"id":20105472,"url":"https://github.com/nnseva/django-access-select2","last_synced_at":"2026-05-15T05:02:59.536Z","repository":{"id":57418720,"uuid":"112368604","full_name":"nnseva/django-access-select2","owner":"nnseva","description":"The application provides a filtering for the Django-Select2 package to use access rules defined by the Django-Access package","archived":false,"fork":false,"pushed_at":"2017-11-28T18:02:38.000Z","size":21,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-26T15:47:43.884Z","etag":null,"topics":["authority","django","django-access","django-select2","dynamic","evaluation","evaluation-based","guard","instance-level","permissions","rights","rights-management","row-level","runtime","select2"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nnseva.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":"2017-11-28T17:46:08.000Z","updated_at":"2020-11-16T05:38:15.000Z","dependencies_parsed_at":"2022-09-13T13:20:25.065Z","dependency_job_id":null,"html_url":"https://github.com/nnseva/django-access-select2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nnseva/django-access-select2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnseva%2Fdjango-access-select2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnseva%2Fdjango-access-select2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnseva%2Fdjango-access-select2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnseva%2Fdjango-access-select2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nnseva","download_url":"https://codeload.github.com/nnseva/django-access-select2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnseva%2Fdjango-access-select2/sbom","scorecard":{"id":691181,"data":{"date":"2025-08-11","repo":{"name":"github.com/nnseva/django-access-select2","commit":"1f7a0b03477cac2227abfec081b18dc9a2eb3567"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"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":"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":"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 0/6 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":"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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: GNU Lesser General Public License v3.0: 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"}}]},"last_synced_at":"2025-08-22T02:20:09.410Z","repository_id":57418720,"created_at":"2025-08-22T02:20:09.410Z","updated_at":"2025-08-22T02:20:09.410Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33054454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-15T02:00:06.351Z","response_time":103,"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":["authority","django","django-access","django-select2","dynamic","evaluation","evaluation-based","guard","instance-level","permissions","rights","rights-management","row-level","runtime","select2"],"created_at":"2024-11-13T17:47:08.501Z","updated_at":"2026-05-15T05:02:59.496Z","avatar_url":"https://github.com/nnseva.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/nnseva/django-access-select2.svg?branch=master)](https://travis-ci.org/nnseva/django-access-select2)\n\n# Django-Access-Select2\n\nThe Django-Access-Select2 package provides a filtering for the [Django-Select2](http://django-select2.readthedocs.io/en/latest/) package to use access rules defined by the [Django-Access](https://github.com/nnseva/django-access) package.\n\n## Installation\n\n*Stable version* from the PyPi package repository\n```bash\npip install django-access-select2\n```\n\n*Last development version* from the GitHub source version control system\n```bash\npip install git+git://github.com/nnseva/django-access-select2.git\n```\n\n## Configuration\n\nInclude the `django_select2`, `access`, and `access_select2` applications into the `INSTALLED_APPS` list, like:\n\n```python\nINSTALLED_APPS = [\n    'django.contrib.admin',\n    'django.contrib.auth',\n    ...\n    'django_select2',\n    'access',\n    'access_select2',\n    ...\n]\n```\n\nRemove if present, the existent reference to the Django-Select2 urlconf from your urlconfs and insert the modified one from the package:\n\n```python\n# url(r'^select2/', include('django_select2.urls')), -- removed\nurl(r'^select2/', include('access_select2.urls')), # -- modified\n```\n\n\n## Using\n\n### Define access rules\n\nDefine access rules as it is described in the [Django-Access](https://github.com/nnseva/django-access) package documentation.\n\nNote that the Django-Access-Select2 package uses only `apply_visible` AccessManager method to filter, what the user can see  in the dropdown list of objects.\n\n### Use the modified widget\n\nRemove if preset, the existent reference to the widget, and use the modified one\n\n```python\n# from django_select2.forms import ModelSelect2Widget, ModelSelect2MultipleWidget, ModelSelect2TagWidget -- removed\nfrom access_select2.forms import ModelSelect2Widget, ModelSelect2MultipleWidget, ModelSelect2TagWidget # -- modified\n```\n\n***Note*** that the `select2.js` library requires `jQuery` media, but Django-Select2 package doesn't refer it.\nSometimes it leads to broken functional of the Django-Select2 package, for instance on the admin page by default. You may use\nany tool to include the `jQuery` media into your pages. For instance, you can use a special `Media` class in your Admin classes,\nor forms using Django-Select2 widgets, like this:\n\n```\nclass SomeObjectAdmin(ModelAdmin):\n    ...\n    class Media:\n        js = ['//code.jquery.com/jquery-2.2.4.js']\n```\n\n### Modified view\n\nThe `AutoResponseView` class is slightly modified by the package: the `get_queryset` method now takes the positional `request` parameter.\n\nIf you are using `AutoResponseView` class directly in your code, yu should replace reference to it to the modified one and modify the\n`get_queryset` method prototype:\n\n```python\n# from django_select2.views import AutoResponseView -- removed\nfrom access_select2.views import AutoResponseView # -- modified\n\nclass MyAutoResponseView(AutoResponseView):\n    ...\n    # def get_queryset(self):          -- removed\n    def get_queryset(self, request): # -- modified\n    ...\n```\n\n## Example\n\nHaving in mind the [example](https://github.com/nnseva/django-access#examples) defined for the [Django-Access](https://github.com/nnseva/django-access), let\nwe use the the package as the following:\n\n```python\nfrom django.contrib import admin\nfrom access.admin import *\n\nfrom access_select2.forms import ModelSelect2Widget, ModelSelect2MultipleWidget, ModelSelect2TagWidget # -- modified\n\nfrom someapp.models import *\n\nclass ChildAdmin(AccessTabularInline):\n    model = SomeChild\n\n# Register your models here.\nclass ObjectAdmin(AccessModelAdmin):\n    inlines = [\n        ChildAdmin,\n    ]\n\n    related_search_fields = {\n        'editor_group': ('name__startswith',),\n        'viewer_groups': ('name__startswith',),\n    }\n\n    def formfield_for_dbfield(self, db_field, **kwargs):\n        \"\"\"\n        Overrides the default widget for Foreignkey fields if they are\n        specified in the select_search_fields class attribute.\n        \"\"\"\n        kw = {}\n        kw.update(kwargs)\n        if isinstance(db_field, models.ForeignKey) and hasattr(self, 'related_search_fields') \\\n                and db_field.name in self.related_search_fields:\n            kw['widget'] = ModelSelect2Widget(model=db_field.target_field.model,search_fields=self.related_search_fields[db_field.name])\n        elif isinstance(db_field, models.ManyToManyField) and hasattr(self, 'related_search_fields') \\\n                and db_field.name in self.related_search_fields:\n            kw['widget'] = ModelSelect2MultipleWidget(model=db_field.target_field.model,search_fields=self.related_search_fields[db_field.name])\n        return super(ObjectAdmin, self).formfield_for_dbfield(db_field, **kw)\n\n    class Media:\n        js = ['//code.jquery.com/jquery-2.2.4.js']\n\n# Register your models here.\nadmin.site.register(SomeObject,ObjectAdmin)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnseva%2Fdjango-access-select2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnnseva%2Fdjango-access-select2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnseva%2Fdjango-access-select2/lists"}