├── example_project ├── __init__.py ├── posts │ ├── __init__.py │ ├── templates │ │ └── posts │ │ │ └── post_detail.html │ ├── urls.py │ ├── views.py │ ├── admin.py │ └── models.py ├── requirements.txt ├── templates │ ├── base_1col.html │ ├── 403.html │ ├── 404.html │ ├── home.html │ ├── 500.html │ └── base.html ├── context_processors.py ├── manage.py ├── urls.py └── settings.py ├── guardian ├── conf │ ├── __init__.py │ └── settings.py ├── migrations │ ├── __init__.py │ ├── 0005_auto__chg_field_groupobjectpermission_object_pk__chg_field_userobjectp.py │ ├── 0003_update_objectpermission_object_pk.py │ ├── 0002_auto__add_field_groupobjectpermission_object_pk__add_field_userobjectp.py │ ├── 0001_initial.py │ └── 0004_auto__del_field_groupobjectpermission_object_id__del_unique_groupobjec.py ├── templatetags │ ├── __init__.py │ └── guardian_tags.py ├── tests │ ├── templates │ │ ├── 404.html │ │ ├── 500.html │ │ └── dummy403.html │ ├── urls.py │ ├── __init__.py │ ├── conf_test.py │ ├── forms_test.py │ ├── custompkmodel_test.py │ ├── utils_test.py │ ├── orphans_test.py │ ├── tags_test.py │ ├── core_test.py │ └── decorators_test.py ├── management │ ├── commands │ │ ├── __init__.py │ │ └── clean_orphan_obj_perms.py │ └── __init__.py ├── __init__.py ├── exceptions.py ├── templates │ └── admin │ │ └── guardian │ │ ├── model │ │ ├── field.html │ │ ├── change_form.html │ │ ├── obj_perms_manage_user.html │ │ ├── obj_perms_manage_group.html │ │ └── obj_perms_manage.html │ │ └── contrib │ │ └── grappelli │ │ ├── field.html │ │ ├── obj_perms_manage_group.html │ │ ├── obj_perms_manage_user.html │ │ └── obj_perms_manage.html ├── testsettings.py ├── fixtures │ └── tests.json ├── backends.py ├── models.py ├── utils.py ├── managers.py ├── core.py ├── decorators.py └── forms.py ├── docs ├── license.rst ├── develop │ ├── changes.rst │ ├── index.rst │ ├── example_project.rst │ └── testing.rst ├── theme │ └── ADCtheme │ │ ├── theme.conf │ │ ├── static │ │ ├── scrn1.png │ │ ├── scrn2.png │ │ ├── documentation.png │ │ ├── header_sm_mid.png │ │ ├── triangle_left.png │ │ ├── triangle_open.png │ │ ├── title_background.png │ │ ├── triangle_closed.png │ │ ├── searchfield_repeat.png │ │ ├── breadcrumb_background.png │ │ ├── searchfield_leftcap.png │ │ ├── searchfield_rightcap.png │ │ ├── mobile.css │ │ └── toc.js │ │ ├── LICENSE │ │ └── layout.html ├── userguide │ ├── index.rst │ ├── remove.rst │ ├── caveats.rst │ ├── admin-integration.rst │ ├── assign.rst │ └── check.rst ├── api │ ├── guardian.core.rst │ ├── guardian.management.commands.rst │ ├── guardian.backends.rst │ ├── guardian.admin.rst │ ├── guardian.templatetags.guardian_tags.rst │ ├── index.rst │ ├── guardian.utils.rst │ ├── guardian.decorators.rst │ ├── guardian.managers.rst │ ├── guardian.models.rst │ ├── guardian.forms.rst │ └── guardian.shortcuts.rst ├── index.rst ├── installation.rst ├── exts.py ├── overview.rst ├── configuration.rst ├── Makefile ├── make.bat └── conf.py ├── setup.cfg ├── .gitignore ├── run_test_and_report.sh ├── AUTHORS ├── MANIFEST.in ├── LICENSE ├── setup.py ├── tests.py ├── README.rst └── CHANGES /example_project/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /guardian/conf/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example_project/posts/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /guardian/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /guardian/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /guardian/tests/templates/404.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /guardian/tests/templates/500.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /guardian/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /guardian/tests/templates/dummy403.html: -------------------------------------------------------------------------------- 1 | foobar403 2 | -------------------------------------------------------------------------------- /example_project/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==1.2.4 2 | wsgiref==0.1.2 3 | -------------------------------------------------------------------------------- /example_project/templates/base_1col.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | -------------------------------------------------------------------------------- /docs/license.rst: -------------------------------------------------------------------------------- 1 | .. _license: 2 | 3 | License 4 | ======= 5 | 6 | .. literalinclude:: ../LICENSE 7 | 8 | -------------------------------------------------------------------------------- /docs/develop/changes.rst: -------------------------------------------------------------------------------- 1 | .. _changes: 2 | 3 | Changelog 4 | --------- 5 | 6 | .. include:: ../../CHANGES 7 | 8 | -------------------------------------------------------------------------------- /example_project/posts/templates/posts/post_detail.html: -------------------------------------------------------------------------------- 1 |
{{ object.content }}
3 | -------------------------------------------------------------------------------- /docs/theme/ADCtheme/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = adctheme.css 4 | pygments_style = friendly 5 | 6 | -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/scrn1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/scrn1.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/scrn2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/scrn2.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/documentation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/documentation.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/header_sm_mid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/header_sm_mid.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/triangle_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/triangle_left.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/triangle_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/triangle_open.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/title_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/title_background.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/triangle_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/triangle_closed.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/searchfield_repeat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/searchfield_repeat.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/breadcrumb_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/breadcrumb_background.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/searchfield_leftcap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/searchfield_leftcap.png -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/searchfield_rightcap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/django-guardian/master/docs/theme/ADCtheme/static/searchfield_rightcap.png -------------------------------------------------------------------------------- /docs/develop/index.rst: -------------------------------------------------------------------------------- 1 | .. _develop: 2 | 3 | Development 4 | =========== 5 | 6 | .. toctree:: 7 | 8 | example_project 9 | testing 10 | changes 11 | 12 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [build_sphinx] 2 | source-dir = docs/ 3 | build-dir = docs/build 4 | all_files = 1 5 | 6 | [upload_sphinx] 7 | upload-dir = docs/build/html 8 | 9 | [bdist_rpm] 10 | requires = Django >= 1.2 11 | -------------------------------------------------------------------------------- /example_project/context_processors.py: -------------------------------------------------------------------------------- 1 | from django.contrib.flatpages.models import FlatPage 2 | 3 | def flats(request): 4 | return { 5 | 'flats': FlatPage.objects.all().values('title', 'url'), 6 | } 7 | 8 | -------------------------------------------------------------------------------- /docs/userguide/index.rst: -------------------------------------------------------------------------------- 1 | .. _guide: 2 | 3 | User Guide 4 | ========== 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | assign 10 | check 11 | remove 12 | admin-integration 13 | caveats 14 | 15 | -------------------------------------------------------------------------------- /example_project/templates/403.html: -------------------------------------------------------------------------------- 1 | {% extends "base_1col.html" %} 2 | 3 | {% block title %}403 - Permission denied{% endblock %} 4 | 5 | {% block content %} 6 |{{ field.help_text }}
{% endif %} 13 |Sorry, but the requested page is unavailable due to a 11 | server hiccup.
12 | 13 |Our engineers have been notified, so check back later.
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/api/guardian.managers.rst: -------------------------------------------------------------------------------- 1 | .. _api-managers: 2 | 3 | Managers 4 | ======== 5 | 6 | .. automodule:: guardian.managers 7 | 8 | 9 | .. manager:: UserObjectPermissionManager 10 | 11 | UserObjectPermissionManager 12 | --------------------------- 13 | 14 | .. autoclass:: guardian.managers.UserObjectPermissionManager 15 | :members: 16 | 17 | 18 | .. manager:: GroupObjectPermissionManager 19 | 20 | GroupObjectPermissionManager 21 | ---------------------------- 22 | 23 | .. autoclass:: guardian.managers.GroupObjectPermissionManager 24 | :members: 25 | -------------------------------------------------------------------------------- /guardian/tests/conf_test.py: -------------------------------------------------------------------------------- 1 | import mock 2 | from django.core.exceptions import ImproperlyConfigured 3 | from django.test import TestCase 4 | from guardian.conf import settings as guardian_settings 5 | 6 | 7 | class TestConfiguration(TestCase): 8 | 9 | def test_check_configuration(self): 10 | 11 | with mock.patch('guardian.conf.settings.RENDER_403', True): 12 | with mock.patch('guardian.conf.settings.RAISE_403', True): 13 | self.assertRaises(ImproperlyConfigured, 14 | guardian_settings.check_configuration) 15 | 16 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. _index: 2 | 3 | ===================================================== 4 | django-guardian - per object permissions for Django 5 | ===================================================== 6 | 7 | :Date: |today| 8 | 9 | **Documentation**: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | overview 15 | installation 16 | configuration 17 | userguide/index 18 | api/index 19 | develop/index 20 | license 21 | 22 | 23 | Indices and tables 24 | ================== 25 | 26 | * :ref:`genindex` 27 | * :ref:`modindex` 28 | * :ref:`search` 29 | 30 | -------------------------------------------------------------------------------- /docs/theme/ADCtheme/static/toc.js: -------------------------------------------------------------------------------- 1 | var TOC = { 2 | load: function () { 3 | $('#toc_button').click(TOC.toggle); 4 | }, 5 | 6 | toggle: function () { 7 | if ($('#sphinxsidebar').toggle().is(':hidden')) { 8 | $('div.document').css('left', "0px"); 9 | $('toc_button').removeClass("open"); 10 | } else { 11 | $('div.document').css('left', "230px"); 12 | $('#toc_button').addClass("open"); 13 | } 14 | return $('#sphinxsidebar'); 15 | } 16 | }; 17 | 18 | $(document).ready(function () { 19 | TOC.load(); 20 | }); -------------------------------------------------------------------------------- /guardian/templates/admin/guardian/model/change_form.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/change_form.html" %} 2 | {% load i18n %} 3 | 4 | {% block object-tools %} 5 | {% if change %}{% if not is_popup %} 6 |{{ field.help_text }}
{% endif %} 15 |{{docstitle}}
38 |