{"id":21016,"library":"bridgekeeper","title":"Bridgekeeper","description":"Bridgekeeper is a Django permissions library that allows rules to be defined as QuerySet filters, enabling efficient, database-level permission checks. Current version is 0.9, compatible with Python >=3.5 and Django 2.0+. Released under MIT License; maintained irregularly with no recent updates.","status":"active","version":"0.9","language":"python","source_language":"en","source_url":"https://github.com/excitedleigh/bridgekeeper","tags":["django","permissions","queryset","authorization"],"install":[{"cmd":"pip install bridgekeeper","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Bridgekeeper is a Django permissions library; requires Django 2.0+","package":"Django","optional":false}],"imports":[{"note":null,"wrong":null,"symbol":"Permission","correct":"from bridgekeeper import Permission"},{"note":null,"wrong":null,"symbol":"rules","correct":"from bridgekeeper import rules"},{"note":"is_staff is in bridgekeeper.rules, not top-level","wrong":"from bridgekeeper import is_staff","symbol":"is_staff","correct":"from bridgekeeper.rules import is_staff"}],"quickstart":{"code":"import os\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')\nimport django\ndjango.setup()\n\nfrom bridgekeeper import Permission\nfrom bridgekeeper.rules import is_authenticated\n\n# Define a simple permission\nview_dashboard = Permission(\n    'view_dashboard',\n    is_authenticated\n)\n\n# In Django settings, define PERMISSIONS dict\n# PERMISSIONS = {'view_dashboard': view_dashboard}","lang":"python","description":"Create a permission that requires the user to be authenticated."},"warnings":[{"fix":"Define PERMISSIONS in settings.py, e.g., PERMISSIONS = {'my_perm': my_permission}","message":"Bridgekeeper expects a dictionary named PERMISSIONS in Django settings. If not defined, no permissions are registered.","severity":"gotcha","affected_versions":">=0.1"},{"fix":"Ensure rules return Q objects or booleans that can be translated to database filters.","message":"Rules in Bridgekeeper are applied as QuerySet filters, not as Python predicates. Mixing logic that cannot be expressed as a filter will cause unexpected behavior.","severity":"gotcha","affected_versions":">=0.1"},{"fix":"Consider alternative libraries like django-guardian or django-rules for newer Django versions.","message":"Bridgekeeper does not actively support Django 4.x or later; test compatibility before upgrading.","severity":"deprecated","affected_versions":"0.9"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from bridgekeeper import rules' (available since 0.8). Upgrade: pip install --upgrade bridgekeeper","cause":"Importing rules from the wrong location or outdated library version.","error":"AttributeError: module 'bridgekeeper' has no attribute 'rules'"},{"fix":"Add 'PERMISSIONS = {}' to settings.py, even if empty.","cause":"PERMISSIONS not defined or set incorrectly in Django settings.","error":"django.core.exceptions.ImproperlyConfigured: The PERMISSIONS setting must be a dict."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}