{"id":13415737,"url":"https://github.com/django-guardian/django-guardian","last_synced_at":"2026-07-11T02:18:10.122Z","repository":{"id":932710,"uuid":"704114","full_name":"django-guardian/django-guardian","owner":"django-guardian","description":"Per object permissions for Django","archived":false,"fork":false,"pushed_at":"2026-07-02T03:53:43.000Z","size":2504,"stargazers_count":3906,"open_issues_count":38,"forks_count":589,"subscribers_count":72,"default_branch":"main","last_synced_at":"2026-07-06T11:32:42.365Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://django-guardian.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/django-guardian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2010-06-04T23:15:37.000Z","updated_at":"2026-07-06T07:48:13.000Z","dependencies_parsed_at":"2023-07-06T17:01:11.847Z","dependency_job_id":"ab04490b-b004-4352-a79e-e1984edb6ef6","html_url":"https://github.com/django-guardian/django-guardian","commit_stats":{"total_commits":939,"total_committers":167,"mean_commits":5.622754491017964,"dds":0.7667731629392971,"last_synced_commit":"77de2033951c2e6b8fba2ac6258defdd23902bbf"},"previous_names":["lukaszb/django-guardian"],"tags_count":48,"template":false,"template_full_name":null,"purl":"pkg:github/django-guardian/django-guardian","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/django-guardian%2Fdjango-guardian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/django-guardian%2Fdjango-guardian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/django-guardian%2Fdjango-guardian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/django-guardian%2Fdjango-guardian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/django-guardian","download_url":"https://codeload.github.com/django-guardian/django-guardian/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/django-guardian%2Fdjango-guardian/sbom","scorecard":{"id":345792,"data":{"date":"2025-08-11","repo":{"name":"github.com/django-guardian/django-guardian","commit":"ad826236f0ac6c37429a548f28a063872ad9aa55"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":7.4,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":6,"reason":"Found 6/10 approved changesets -- score normalized to 6","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":"Maintained","score":10,"reason":"13 commit(s) and 6 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"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":"Token-Permissions","score":9,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release-publish.yml:21","Warn: no topLevel permission defined: .github/workflows/release-publish.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/tests.yml:4"],"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":"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":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-publish.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/django-guardian/django-guardian/release-publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-publish.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/django-guardian/django-guardian/release-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-publish.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/django-guardian/django-guardian/release-publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-publish.yml:78: update your workflow using https://app.stepsecurity.io/secureworkflow/django-guardian/django-guardian/release-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-publish.yml:94: update your workflow using https://app.stepsecurity.io/secureworkflow/django-guardian/django-guardian/release-publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-publish.yml:99: update your workflow using https://app.stepsecurity.io/secureworkflow/django-guardian/django-guardian/release-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-publish.yml:102: update your workflow using https://app.stepsecurity.io/secureworkflow/django-guardian/django-guardian/release-publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-publish.yml:111: update your workflow using https://app.stepsecurity.io/secureworkflow/django-guardian/django-guardian/release-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/django-guardian/django-guardian/tests.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/django-guardian/django-guardian/tests.yml/main?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned"],"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":"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":"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":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"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":"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":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release-publish.yml:87"],"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":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":2,"reason":"SAST tool is not run on all commits -- score normalized to 2","details":["Warn: 8 commits out of 29 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"}}]},"last_synced_at":"2025-08-18T06:59:25.802Z","repository_id":932710,"created_at":"2025-08-18T06:59:25.802Z","updated_at":"2025-08-18T06:59:25.802Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35334846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-10T02:00:06.465Z","response_time":60,"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":["hacktoberfest"],"created_at":"2024-07-30T21:00:51.741Z","updated_at":"2026-07-11T02:18:10.102Z","avatar_url":"https://github.com/django-guardian.png","language":"Python","funding_links":[],"categories":["Third-Party Packages","Authorization","Permissions","资源列表","授权","Libs","Python","权限","Security","Best Django Admin Interface Resources","Authorization \u0026 Authentication","Permissions [🔝](#readme)","Awesome Python","Authentication \u0026 Authorization"],"sub_categories":["General","权限","Permissions management","Permissions","**🖥️ Django REST Framework \u0026 API-Related Packages**","Podcasts"],"readme":"# django-guardian\n\n[![Tests](https://github.com/django-guardian/django-guardian/workflows/Tests/badge.svg?branch=devel)](https://github.com/django-guardian/django-guardian/actions/workflows/tests.yml)\n[![PyPI version](https://img.shields.io/pypi/v/django-guardian.svg)](https://pypi.python.org/pypi/django-guardian)\n[![Python versions](https://img.shields.io/pypi/pyversions/django-guardian.svg)](https://pypi.python.org/pypi/django-guardian)\n\n`django-guardian` is an implementation of _per-object permissions_ on top\nof Django’s authorization backend. Read an introduction to per-object permissions [on djangoadvent articles](https://github.com/djangoadvent/djangoadvent-articles/blob/master/1.2/06_object-permissions.rst).\n\n## Documentation\n\nOnline documentation is available at [https://django-guardian.readthedocs.io/](https://django-guardian.readthedocs.io/).\n\n\n## Installation\n\nTo install `django-guardian` into your project run:\n\n```bash\nuv add django-guardian\n```\n\u003e **TIP**: Not using a package manager like `uv` or `poetry` for your django project? You probably should try them :). In the meantime, `pip install django-guardian` works just fine too.\n\n\n## Configuration\n\nWe need to hook `django-guardian`` into our project.\n\n1. Put `guardian` into your `INSTALLED_APPS` at settings module:\n\n```python\n    INSTALLED_APPS = (\n     ...\n     'guardian',\n    )\n```\n\n2. Add extra authorization backend to your `settings.py`:\n\n```py\n    AUTHENTICATION_BACKENDS = (\n        'django.contrib.auth.backends.ModelBackend',\n        'guardian.backends.ObjectPermissionBackend',\n    )\n```\n\n3. Create `guardian` database tables by running::\n\n```\n     python manage.py migrate\n```\n\n## Usage\n\nAfter installation and project hooks we can finally use object permissions\nwith Django.\n\nLets start really quickly:\n\n```py\n      \u003e\u003e\u003e from django.contrib.auth.models import User, Group\n      \u003e\u003e\u003e jack = User.objects.create_user('jack', 'jack@example.com', 'topsecretagentjack')\n      \u003e\u003e\u003e admins = Group.objects.create(name='admins')\n      \u003e\u003e\u003e jack.has_perm('change_group', admins)\n      False\n      \u003e\u003e\u003e from guardian.shortcuts import assign_perm\n      \u003e\u003e\u003e assign_perm('change_group', jack, obj=admins)\n      \u003cUserObjectPermission: admins | jack | change_group\u003e\n      \u003e\u003e\u003e jack.has_perm('change_group', admins)\n      True\n```\n\nOf course our agent jack here would not be able to _change_group_ globally:\n\n```py\n\n    \u003e\u003e\u003e jack.has_perm('change_group')\n    False\n```\n\n## Admin integration\n\nReplace `admin.ModelAdmin` with `GuardedModelAdmin` for those models\nwhich should have object permissions support within admin panel.\n\nFor example:\n\n```py\n    from django.contrib import admin\n    from myapp.models import Author\n    from guardian.admin import GuardedModelAdmin\n\n    # Old way:\n    #class AuthorAdmin(admin.ModelAdmin):\n    #    pass\n\n    # With object permissions support\n    class AuthorAdmin(GuardedModelAdmin):\n        pass\n\n    admin.site.register(Author, AuthorAdmin)\n```\n\n## Django Unfold integration\n\nUsers of [`django-unfold`](https://unfoldadmin.com/) will find that `guardian` is [supported out of the box via a `contrib` module](https://unfoldadmin.com/docs/integrations/django-guardian/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjango-guardian%2Fdjango-guardian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjango-guardian%2Fdjango-guardian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjango-guardian%2Fdjango-guardian/lists"}