{"id":13491381,"url":"https://github.com/yourlabs/django-rules-light","last_synced_at":"2025-03-28T08:33:04.229Z","repository":{"id":5633710,"uuid":"6841936","full_name":"yourlabs/django-rules-light","owner":"yourlabs","description":"Maintenance only","archived":false,"fork":false,"pushed_at":"2024-04-17T04:50:36.000Z","size":259,"stargazers_count":68,"open_issues_count":2,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-17T12:36:49.202Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://django-rules-light.rtfd.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yourlabs.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-11-24T16:52:49.000Z","updated_at":"2024-01-27T07:54:50.000Z","dependencies_parsed_at":"2024-07-31T21:49:56.989Z","dependency_job_id":"d14339a3-8690-4059-b001-9687ebe38cb9","html_url":"https://github.com/yourlabs/django-rules-light","commit_stats":{"total_commits":134,"total_committers":6,"mean_commits":"22.333333333333332","dds":"0.26865671641791045","last_synced_commit":"5f80ea74da77da484e0c5d9f885662e2432d58cb"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourlabs%2Fdjango-rules-light","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourlabs%2Fdjango-rules-light/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourlabs%2Fdjango-rules-light/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourlabs%2Fdjango-rules-light/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yourlabs","download_url":"https://codeload.github.com/yourlabs/django-rules-light/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245996539,"owners_count":20707262,"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-07-31T19:00:56.405Z","updated_at":"2025-03-28T08:33:03.851Z","avatar_url":"https://github.com/yourlabs.png","language":"Python","funding_links":[],"categories":["Libs","Python"],"sub_categories":["Other"],"readme":".. image:: https://secure.travis-ci.org/yourlabs/django-rules-light.png?branch=master\n    :target: http://travis-ci.org/yourlabs/django-rules-light\n.. image:: https://img.shields.io/pypi/dm/django-rules-light.svg\n    :target: https://crate.io/packages/django-rules-light\n.. image:: https://img.shields.io/pypi/v/django-rules-light.svg   \n    :target: https://crate.io/packages/django-rules-light\n\nThis is a simple alternative to django-rules. Its core difference is that\nit does not rely on models. Instead, it uses a registry which can be\nmodified at runtime.\n\nOne of its goals is to enable developers of external apps to make rules,\ndepend on it, while allowing a project to override rules.\n\nExample ``your_app/rules_light_registry.py``:\n\n.. code-block:: python\n\n    # Everybody can read a blog post (for now!):\n    rules_light.registry['blog.post.read'] = True\n\n    # Require authentication to create a blog post, using a shortcut:\n    rules_light.registry['blog.post.create'] = rules_light.is_authenticated\n\n    # But others shouldn't mess with my posts !\n    def is_staff_or_mine(user, rule, obj):\n        return user.is_staff or obj.author == user\n\n    rules_light.registry['blog.post.update'] = is_staff_or_mine\n    rules_light.registry['blog.post.delete'] = is_staff_or_mine\n\nExample ``your_app/views.py``:\n\n.. code-block:: python\n\n    @rules_light.class_decorator\n    class PostDetailView(generic.DetailView):\n        model = Post\n\n    @rules_light.class_decorator\n    class PostCreateView(generic.CreateView):\n        model = Post\n\n    @rules_light.class_decorator\n    class PostUpdateView(generic.UpdateView):\n        model = Post\n\n    @rules_light.class_decorator\n    class PostDeleteView(generic.DeleteView):\n        model = Post\n\nYou might want to read the `tutorial\n\u003chttps://django-rules-light.readthedocs.org/en/latest/tutorial.html\u003e`_ for\nmore.\n\nWhat's the catch ?\n------------------\n\nThe catch is that this approach does not offer any feature to get secure\nquerysets.\n\nThis means you have to:\n\n- think about security when making querysets,\n- `override\n  \u003chttp://blog.yourlabs.org/post/19777151073/how-to-override-a-view-from-an-external-django-app\u003e`_\n  eventual external app ListViews,\n\nRequirements\n------------\n\n- Python 2.7+ (Python 3 supported)\n- Django 1.8+\n\nQuick Install\n-------------\n\n- Install module: ``pip install django-rules-light``,\n- Add to ``settings.INSTALLED_APPS``: ``rules_light``,\n- Add in ``settings.MIDDLEWARE_CLASSES`` (or ``settings.MIDDLEWARE`` for Django 1.10+): ``rules_light.middleware.Middleware``,\n\n\nYou might want to read the `tutorial\n\u003chttps://django-rules-light.readthedocs.org/en/latest/tutorial.html\u003e`_.\n\nThere is also a lot of documentation, from the core to the tools, including\npointers to debug, log and test your security.\n\nContributing\n------------\n\nRun tests with the `tox\n\u003chttps://pypi.python.org/pypi/tox\u003e`_ command. Documented patches passing all\ntests have a better chance to get merged in. See `community guidelines\n\u003chttp://docs.yourlabs.org\u003e`_ for details.\n\nResources\n---------\n\nTo ask questions or just get informed about package updates, you could\nsubscribe to the mailing list.\n\n- `Mailing list graciously hosted\n  \u003chttp://groups.google.com/group/yourlabs\u003e`_ by `Google\n  \u003chttp://groups.google.com\u003e`_\n- `Git graciously hosted\n  \u003chttps://github.com/yourlabs/django-rules-light/\u003e`_ by `GitHub\n  \u003chttp://github.com\u003e`_,\n- `Documentation graciously hosted\n  \u003chttp://django-rules-light.rtfd.org\u003e`_ by `RTFD\n  \u003chttp://rtfd.org\u003e`_,\n- `Package graciously hosted\n  \u003chttp://pypi.python.org/pypi/django-rules-light/\u003e`_ by `PyPi\n  \u003chttp://pypi.python.org/pypi\u003e`_,\n- `Continuous integration graciously hosted\n  \u003chttp://travis-ci.org/yourlabs/django-rules-light\u003e`_ by `Travis-ci\n  \u003chttp://travis-ci.org\u003e`_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyourlabs%2Fdjango-rules-light","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyourlabs%2Fdjango-rules-light","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyourlabs%2Fdjango-rules-light/lists"}