[Python-modules-commits] [django-guardian] 01/02: New upstream version 1.4.8

Brian May bam at moszumanska.debian.org
Sun Jun 25 03:12:47 UTC 2017


This is an automated email from the git hooks/post-receive script.

bam pushed a commit to branch debian/master
in repository django-guardian.

commit 0033bf7fd7270358c31acd4f2d61755265a86a72
Author: Brian May <bam at debian.org>
Date:   Sun Jun 25 13:11:20 2017 +1000

    New upstream version 1.4.8
---
 .gitignore                                         |   1 +
 .isort.cfg                                         |   4 +
 .travis.yml                                        |  60 +++-----
 AUTHORS                                            |   1 +
 CHANGES                                            |  48 +++++++
 LICENSE                                            |   2 +-
 MANIFEST.in                                        |  10 +-
 PKG-INFO                                           | 118 +++++++++++++++-
 README.rst                                         |  73 ++++++----
 benchmarks/models.py                               |   4 +-
 django_guardian.egg-info/PKG-INFO                  | 118 +++++++++++++++-
 django_guardian.egg-info/SOURCES.txt               |  28 ++--
 django_guardian.egg-info/requires.txt              |   1 -
 docs/api/guardian.mixins.rst                       |   5 +
 docs/conf.py                                       |   7 +-
 docs/configuration.rst                             |  18 +++
 docs/overview.rst                                  |   4 +-
 docs/userguide/admin-integration.rst               |   1 -
 docs/userguide/assign.rst                          |   7 +-
 docs/userguide/custom-user-model.rst               |   2 +-
 docs/userguide/performance.rst                     |   6 +-
 example_project/articles/__init__.py               |   0
 example_project/articles/admin.py                  |  10 ++
 example_project/articles/apps.py                   |   7 +
 .../articles/migrations/0001_initial.py            |  66 +++++++++
 .../articles/migrations/0002_auto_20160622_1050.py |  19 +++
 example_project/articles/migrations/__init__.py    |   0
 example_project/articles/models.py                 |  34 +++++
 .../templates/articles/article_confirm_delete.html |  13 ++
 .../templates/articles/article_detail.html         |  28 ++++
 .../articles/templates/articles/article_form.html  |  18 +++
 .../articles/templates/articles/article_list.html  |  25 ++++
 example_project/articles/tests.py                  |  98 +++++++++++++
 example_project/articles/urls.py                   |  18 +++
 example_project/articles/views.py                  |  42 ++++++
 example_project/{ => core}/context_processors.py   |   0
 example_project/core/migrations/0001_initial.py    |  15 +-
 example_project/manage.py                          |   2 +-
 example_project/settings.py                        |  17 ++-
 example_project/templates/base.html                |   3 +-
 example_project/urls.py                            |   2 +-
 guardian/__init__.py                               |  19 +--
 guardian/admin.py                                  |  71 ++++++----
 guardian/apps.py                                   |   3 +-
 guardian/backends.py                               |  19 ++-
 guardian/checks.py                                 |   3 +-
 guardian/compat.py                                 |  56 ++++++--
 guardian/conf/settings.py                          |   5 +
 guardian/core.py                                   |  43 +++---
 guardian/ctypes.py                                 |  16 +++
 guardian/decorators.py                             |  31 ++++-
 guardian/forms.py                                  |   8 +-
 guardian/managers.py                               | 152 ++++++++++++---------
 guardian/migrations/0001_initial.py                |  12 +-
 guardian/mixins.py                                 |  98 +++++++++++--
 guardian/models.py                                 |  29 ++--
 guardian/shortcuts.py                              | 140 +++++++++++--------
 .../admin/guardian/contrib/grappelli/field.html    |   7 -
 .../contrib/grappelli/obj_perms_manage.html        |  30 ++--
 .../contrib/grappelli/obj_perms_manage_group.html  |  29 +++-
 .../contrib/grappelli/obj_perms_manage_user.html   |  29 +++-
 guardian/templatetags/guardian_tags.py             |   5 +-
 guardian/testapp/migrations/0001_initial.py        | 117 +++++++++++-----
 .../testapp/migrations/0002_logentrywithgroup.py   |  13 +-
 .../testapp/migrations/0003_auto_20141124_0729.py  |  30 ----
 .../testapp/migrations/0004_auto_20151112_2209.py  |  36 -----
 .../testapp/migrations/0005_auto_20151217_2344.py  |  22 ---
 .../testapp/migrations/0006_auto_20160221_1054.py  |  30 ----
 .../testapp/migrations/0007_auto_20160309_0245.py  |  46 -------
 guardian/testapp/models.py                         |  25 ++--
 guardian/testapp/tests/templates/dummy404.html     |   1 +
 guardian/testapp/tests/templates/list.html         |   5 +
 guardian/testapp/tests/test_admin.py               |  16 ++-
 guardian/testapp/tests/test_conf.py                |  10 ++
 guardian/testapp/tests/test_core.py                | 105 +++++++++-----
 guardian/testapp/tests/test_custompkmodel.py       |   2 +-
 guardian/testapp/tests/test_decorators.py          |  51 ++++++-
 guardian/testapp/tests/test_direct_rel.py          |  72 ++++++----
 guardian/testapp/tests/test_managers.py            |  21 ++-
 guardian/testapp/tests/test_mixins.py              |  56 +++++++-
 guardian/testapp/tests/test_shortcuts.py           |  51 ++++++-
 guardian/testapp/tests/urls.py                     |   2 +-
 guardian/testapp/testsettings.py                   |  19 ++-
 guardian/utils.py                                  |  44 +++---
 guardian/version.py                                |   4 -
 requirements.txt                                   |   4 +-
 setup.cfg                                          |  13 +-
 setup.py                                           |  18 +--
 tox.ini                                            |  58 ++++----
 89 files changed, 1860 insertions(+), 751 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8726775..d13cf62 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,7 @@ example_project/media
 example_project/conf/*.py
 .idea/
 .eggs/
+.cache/
 
 # WebDAV remote filesystem
 .DAV
diff --git a/.isort.cfg b/.isort.cfg
new file mode 100644
index 0000000..5b39d05
--- /dev/null
+++ b/.isort.cfg
@@ -0,0 +1,4 @@
+[settings]
+line_length=120
+force_single_line=False
+force_alphabetical_sort=True
diff --git a/.travis.yml b/.travis.yml
index a8beb80..985959e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,38 +1,45 @@
 language: python
 sudo: false
+
+cache: pip
+
 python:
  - 2.7
- - 3.3
  - 3.4
  - 3.5
+ - 3.6
 
 env:
- - DJANGO_VERSION=1.7.10 DATABASE_URL=postgres://postgres@/django_guardian
- - DJANGO_VERSION=1.8.7 DATABASE_URL=postgres://postgres@/django_guardian
- - DJANGO_VERSION=1.9.1 DATABASE_URL=postgres://postgres@/django_guardian
+ - DJANGO_VERSION=1.8 DATABASE_URL=postgres://postgres@/django_guardian
+ - DJANGO_VERSION=1.10 DATABASE_URL=postgres://postgres@/django_guardian
+ - DJANGO_VERSION=1.11 DATABASE_URL=postgres://postgres@/django_guardian
  - DJANGO_VERSION=master DATABASE_URL=postgres://postgres@/django_guardian
 
- - DJANGO_VERSION=1.7.10 DATABASE_URL=mysql://root:@localhost/django_guardian
- - DJANGO_VERSION=1.8.7 DATABASE_URL=mysql://root:@localhost/django_guardian
- - DJANGO_VERSION=1.9.1 DATABASE_URL=mysql://root:@localhost/django_guardian
+ - DJANGO_VERSION=1.8 DATABASE_URL=mysql://root:@localhost/django_guardian
+ - DJANGO_VERSION=1.10 DATABASE_URL=mysql://root:@localhost/django_guardian
+ - DJANGO_VERSION=1.11 DATABASE_URL=mysql://root:@localhost/django_guardian
  - DJANGO_VERSION=master DATABASE_URL=mysql://root:@localhost/django_guardian
 
- - DJANGO_VERSION=1.7.10 DATABASE_URL=sqlite://
- - DJANGO_VERSION=1.8.7 DATABASE_URL=sqlite://
- - DJANGO_VERSION=1.9.1 DATABASE_URL=sqlite://
+ - DJANGO_VERSION=1.8 DATABASE_URL=sqlite://
+ - DJANGO_VERSION=1.10 DATABASE_URL=sqlite://
+ - DJANGO_VERSION=1.11 DATABASE_URL=sqlite://
  - DJANGO_VERSION=master DATABASE_URL=sqlite://
 
+before_install:
+  - pip install -q -U pytest
+
 install:
   - travis_retry pip install -q mock==1.0.1 pytest pytest-django pytest-cov django-environ setuptools_scm
 # Install django master or version
   - bash -c "if [[ "$DJANGO_VERSION" == 'master' ]]; then pip install 'https://github.com/django/django/archive/master.tar.gz'; else pip install Django==$DJANGO_VERSION; fi; "
 # Install database drivers
-  - bash -c "if [[ $DATABASE_URL = postgres* ]]; then pip install psycopg2==2.6.1; fi; "
-  - bash -c "if [[ $DATABASE_URL = mysql* ]]; then pip install mysqlclient==1.3.7; fi; "
+  - bash -c "if [[ $DATABASE_URL = postgres* ]]; then pip install psycopg2==2.7.1; fi; "
+  - bash -c "if [[ $DATABASE_URL = mysql* ]]; then pip install mysqlclient==1.3.10; fi; "
 
 script:
   - python ./setup.py --version
   - py.test --cov=guardian
+  - bash -c "if [[ $DJANGO_VERSION = 1.10 || $DJANGO_VERSION = 1.11 || $DJANGO_VERSION = "master" ]]; then pip install .; cd example_project; python manage.py test; fi; "
 
 notifications:
   irc: "irc.freenode.net#django-guardian"
@@ -40,35 +47,6 @@ notifications:
 
 matrix:
   fast_finish: true
-  exclude:
-      # Drop python 3.3 and django 1.9
-      - python: 3.3
-        env: DJANGO_VERSION=1.9.1 DATABASE_URL=postgres://postgres@/django_guardian
-      - python: 3.3
-        env: DJANGO_VERSION=1.9.1 DATABASE_URL=mysql://root:@localhost/django_guardian
-      - python: 3.3
-        env: DJANGO_VERSION=1.9.1 DATABASE_URL=sqlite://
-      # Drop python 3.3 and django master
-      - python: 3.3
-        env: DJANGO_VERSION=master DATABASE_URL=postgres://postgres@/django_guardian
-      - python: 3.3
-        env: DJANGO_VERSION=master DATABASE_URL=mysql://root:@localhost/django_guardian
-      - python: 3.3
-        env: DJANGO_VERSION=master DATABASE_URL=sqlite://
-      # Drop python 3.5 and django 1.7
-      - python: 3.5
-        env: DJANGO_VERSION=1.7.10 DATABASE_URL=postgres://postgres@/django_guardian
-      - python: 3.5
-        env: DJANGO_VERSION=1.7.10 DATABASE_URL=mysql://root:@localhost/django_guardian
-      - python: 3.5
-        env: DJANGO_VERSION=1.7.10 DATABASE_URL=sqlite://
-      # Drop python 3.3 with postgres due lack of driver
-      - python: 3.3
-        env: DJANGO_VERSION=1.7.10 DATABASE_URL=postgres://postgres@/django_guardian
-      - python: 3.3
-        env: DJANGO_VERSION=1.8.7 DATABASE_URL=postgres://postgres@/django_guardian
-      - python: 3.3
-        env: DJANGO_VERSION=1.9.1 DATABASE_URL=postgres://postgres@/django_guardian
   allow_failures:
       - env: DJANGO_VERSION=master DATABASE_URL=postgres://postgres@/django_guardian
       - env: DJANGO_VERSION=master DATABASE_URL=mysql://root:@localhost/django_guardian
diff --git a/AUTHORS b/AUTHORS
index dab4293..7a13a24 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -55,3 +55,4 @@ Authors ordered by first contribution
 - Bertrand Svetchine <bertrand.svetchine at gmail.com>
 - Frank Wickström <frank at bambuser.com>
 - George Karakostas <gckarakostas at gmail.com>
+- Adam Dobrawy <guardian at jawnosc.tk>
diff --git a/CHANGES b/CHANGES
index cf66e38..89cc45f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,51 @@
+Release 1.4.8 (Apr 04, 2017)
+============================
+
+* Improved performance of `clean_orphan_obj_perms` management command
+* Use bumpversion for versioning.
+* Enable Python 3.6 testing
+* Python 2.7, 3.4, 3.5, 3.6 are only supported Python versions
+* Django 1.8, 1.10, and 1.11 are only supported Django versions
+* Added explicity on_delete to all ForeignKeys
+
+Release 1.4.6 (Sep 09, 2016)
+============================
+
+* Improved performance of get_objects_for_user
+* Added test-covered and documented guardian.mixins.PermissionListMixin
+* Allow content type retrieval to be overridden fg. for django-polymorphic support
+* Added support CreateView-like (no object) view in PermissionRequiredMixin
+* Added django 1.10 to TravisCI and tox
+* Run tests for example_project in TravisCI
+* Require django 1.9+ for example_project (django-guardian core support django 1.7+)
+* Fix django versions compatibility in example_project
+* Drop django in install_requires of setuptools
+
+Release 1.4.5 (Aug 09, 2016)
+============================
+
+* Fix caching issue with prefetch_perms.
+* Convert readthedocs link for their .org -> .io migration for hosted projects
+* Added example CRUD CBV project
+* Added TEMPLATES in example_project settings
+* Added Queryset support to assign_perm
+* Added QuerySet support to remove_perm
+* Updated assign_perm and remove_perm docstrings
+* Moved queryset support in assign_perms to its own function
+* Moved queryset support in remove_perms to its own function
+* Consolidated {User,Group}ObjectPermissionManager, move logic of bulk_*_perm
+  to managers
+* `assign_perm` and `remove_perm` shortcuts accept `Permission` 
+  instance as `perm` and `QuerySet` as `obj` too.
+* Consolidated bulk_assign_perm to assign_perm and bulk_remove_perm to remove_perm
+* Upgraded Grappelli templates breadcrumbs block to new Django 1.9 and
+  Grappelli 2.8 standards, including proper URLs and support for
+  preserved_filters. Removed the duplicated field.errors in the field.html
+  template file.
+* Made UserManage/GroupManage forms overridable
+* Fixed GuardedModelAdminMixin views render for Django 1.10
+
+
 Release 1.4.4 (Apr 04, 2016)
 ============================
 
diff --git a/LICENSE b/LICENSE
index 9846779..07b8de9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2010-2014 Lukasz Balcerzak <lukaszbalcerzak at gmail.com>
+Copyright (c) 2010-2016 Lukasz Balcerzak <lukaszbalcerzak at gmail.com>
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff --git a/MANIFEST.in b/MANIFEST.in
index 6c0715c..56d90ad 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -3,25 +3,19 @@ include LICENSE
 include README.rst
 include MANIFEST.in
 include *.py
+include *.ini
 include run_test_and_report.sh
 include *.txt
 include AUTHORS
-include tox.ini
 recursive-include guardian *.py
 recursive-include guardian/locale *.po *.mo
-recursive-include guardian/fixtures *.json
-recursive-include guardian/templates *.html
-recursive-include guardian/tests/templates *.html
 recursive-include docs *.bat
-recursive-include docs *.conf
 recursive-include docs *.css
 recursive-include docs *.eot
 recursive-include docs *.html
 recursive-include docs *.js
 recursive-include docs *.py
-recursive-include docs *.rb
 recursive-include docs *.rst
-recursive-include docs *.sass
 recursive-include docs *.sh
 recursive-include docs *.svg
 recursive-include docs *.ttf
@@ -32,6 +26,8 @@ recursive-include example_project *.html
 recursive-include example_project *.js
 recursive-include example_project *.png
 recursive-include example_project *.txt
+recursive-include example_project *.py
 recursive-exclude docs/build *
 recursive-include guardian *.html
 recursive-include guardian *.svg
+recursive-include benchmarks *.py
diff --git a/PKG-INFO b/PKG-INFO
index 410badf..a1090a9 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-guardian
-Version: 1.4.4
+Version: 1.4.8
 Summary: Implementation of per object permissions for Django.
 Home-page: http://github.com/django-guardian/django-guardian
 Author: Lukasz Balcerzak
@@ -8,6 +8,120 @@ Author-email: lukaszbalcerzak at gmail.com
 License: BSD
 Download-URL: https://github.com/django-guardian/django-guardian/tags
 Description: ===============
+        django-guardian
+        ===============
+        
+        .. image:: https://travis-ci.org/django-guardian/django-guardian.svg?branch=devel
+          :target: https://travis-ci.org/django-guardian/django-guardian
+        
+        ``django-guardian`` is an implementation of per object permissions [1]_ on top
+        of Django's authorization backend
+        
+        Documentation
+        -------------
+        
+        Online documentation is available at https://django-guardian.readthedocs.io/.
+        
+        Requirements
+        ------------
+        
+        * Python 2.7 or 3.4+
+        * A supported version of Django (currently 1.8+)
+        
+        Travis CI tests on Django version 1.8, 1.10, and 1.11.
+        
+        Installation
+        ------------
+        
+        To install ``django-guardian`` simply run::
+        
+            pip install django-guardian
+        
+        Configuration
+        -------------
+        
+        We need to hook ``django-guardian`` into our project.
+        
+        1. Put ``guardian`` into your ``INSTALLED_APPS`` at settings module:
+        
+        .. code:: python
+        
+            INSTALLED_APPS = (
+             ...
+             'guardian',
+            )
+           
+        2. Add extra authorization backend to your ``settings.py``:
+        
+        .. code:: python
+        
+            AUTHENTICATION_BACKENDS = (
+                'django.contrib.auth.backends.ModelBackend', # default
+                'guardian.backends.ObjectPermissionBackend',
+            )
+        
+        3. Create ``guardian`` database tables by running::
+        
+             python manage.py migrate
+        
+        Usage
+        -----
+        
+        After installation and project hooks we can finally use object permissions
+        with Django_.
+        
+        Lets start really quickly:
+        
+        .. code:: python
+        
+              >>> from django.contrib.auth.models import User, Group
+              >>> jack = User.objects.create_user('jack', 'jack at example.com', 'topsecretagentjack')
+              >>> admins = Group.objects.create(name='admins')
+              >>> jack.has_perm('change_group', admins)
+              False
+              >>> from guardian.models import UserObjectPermission
+              >>> UserObjectPermission.objects.assign_perm('change_group', jack, obj=admins)
+              <UserObjectPermission: admins | jack | change_group>
+              >>> jack.has_perm('change_group', admins)
+              True
+        
+        Of course our agent jack here would not be able to *change_group* globally:
+        
+        .. code:: python
+        
+            >>> jack.has_perm('change_group')
+            False
+        
+        Admin integration
+        -----------------
+        
+        Replace ``admin.ModelAdmin`` with ``GuardedModelAdmin`` for those models
+        which should have object permissions support within admin panel.
+        
+        For example:
+        
+        .. code:: python
+        
+            from django.contrib import admin
+            from myapp.models import Author
+            from guardian.admin import GuardedModelAdmin
+        
+            # Old way:
+            #class AuthorAdmin(admin.ModelAdmin):
+            #    pass
+        
+            # With object permissions support
+            class AuthorAdmin(GuardedModelAdmin):
+                pass
+        
+            admin.site.register(Author, AuthorAdmin)
+        
+        
+        .. [1] Great paper about this feature is available at `djangoadvent articles <https://github.com/djangoadvent/djangoadvent-articles/blob/master/1.2/06_object-permissions.rst>`_.
+        
+        .. _Django: http://www.djangoproject.com/
+        
+        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Web Environment
@@ -18,6 +132,6 @@ Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
 Classifier: Topic :: Security
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
diff --git a/README.rst b/README.rst
index 3ad0dee..6f2b3a1 100644
--- a/README.rst
+++ b/README.rst
@@ -5,14 +5,21 @@ django-guardian
 .. image:: https://travis-ci.org/django-guardian/django-guardian.svg?branch=devel
   :target: https://travis-ci.org/django-guardian/django-guardian
 
-``django-guardian`` is implementation of per object permissions [1]_ as 
-authorization backend which is supported since Django_ 1.5. It won't
-work with older Django_ releases.
+``django-guardian`` is an implementation of per object permissions [1]_ on top
+of Django's authorization backend
 
 Documentation
 -------------
 
-Online documentation is available at http://django-guardian.rtfd.org/.
+Online documentation is available at https://django-guardian.readthedocs.io/.
+
+Requirements
+------------
+
+* Python 2.7 or 3.4+
+* A supported version of Django (currently 1.8+)
+
+Travis CI tests on Django version 1.8, 1.10, and 1.11.
 
 Installation
 ------------
@@ -26,21 +33,25 @@ Configuration
 
 We need to hook ``django-guardian`` into our project.
 
-1. Put ``guardian`` into your ``INSTALLED_APPS`` at settings module::
+1. Put ``guardian`` into your ``INSTALLED_APPS`` at settings module:
+
+.. code:: python
 
-      INSTALLED_APPS = (
-         ...
-         'guardian',
-      )
+    INSTALLED_APPS = (
+     ...
+     'guardian',
+    )
    
-2. Add extra authorization backend to your `settings.py`::
+2. Add extra authorization backend to your ``settings.py``:
 
-      AUTHENTICATION_BACKENDS = (
-          'django.contrib.auth.backends.ModelBackend', # default
-          'guardian.backends.ObjectPermissionBackend',
-      )
+.. code:: python
 
-4. Create ``guardian`` database tables by running::
+    AUTHENTICATION_BACKENDS = (
+        'django.contrib.auth.backends.ModelBackend', # default
+        'guardian.backends.ObjectPermissionBackend',
+    )
+
+3. Create ``guardian`` database tables by running::
 
      python manage.py migrate
 
@@ -50,20 +61,24 @@ Usage
 After installation and project hooks we can finally use object permissions
 with Django_.
 
-Lets start really quickly::
+Lets start really quickly:
 
-    >>> from django.contrib.auth.models import User, Group
-    >>> jack = User.objects.create_user('jack', 'jack at example.com', 'topsecretagentjack')
-    >>> admins = Group.objects.create(name='admins')
-    >>> jack.has_perm('change_group', admins)
-    False
-    >>> from guardian.models import UserObjectPermission
-    >>> UserObjectPermission.objects.assign_perm('change_group', user=jack, obj=admins)
-    <UserObjectPermission: admins | jack | change_group>
-    >>> jack.has_perm('change_group', admins)
-    True
+.. code:: python
+
+      >>> from django.contrib.auth.models import User, Group
+      >>> jack = User.objects.create_user('jack', 'jack at example.com', 'topsecretagentjack')
+      >>> admins = Group.objects.create(name='admins')
+      >>> jack.has_perm('change_group', admins)
+      False
+      >>> from guardian.models import UserObjectPermission
+      >>> UserObjectPermission.objects.assign_perm('change_group', jack, obj=admins)
+      <UserObjectPermission: admins | jack | change_group>
+      >>> jack.has_perm('change_group', admins)
+      True
 
-Of course our agent jack here would not be able to *change_group* globally::
+Of course our agent jack here would not be able to *change_group* globally:
+
+.. code:: python
 
     >>> jack.has_perm('change_group')
     False
@@ -74,7 +89,9 @@ Admin integration
 Replace ``admin.ModelAdmin`` with ``GuardedModelAdmin`` for those models
 which should have object permissions support within admin panel.
 
-For example::
+For example:
+
+.. code:: python
 
     from django.contrib import admin
     from myapp.models import Author
diff --git a/benchmarks/models.py b/benchmarks/models.py
index f36c92b..6968afb 100644
--- a/benchmarks/models.py
+++ b/benchmarks/models.py
@@ -8,11 +8,11 @@ class TestModel(models.Model):
 
 
 class DirectUser(UserObjectPermissionBase):
-    content_object = models.ForeignKey('TestDirectModel')
+    content_object = models.ForeignKey('TestDirectModel', on_delete=models.CASCADE)
 
 
 class DirectGroup(GroupObjectPermissionBase):
-    content_object = models.ForeignKey('TestDirectModel')
+    content_object = models.ForeignKey('TestDirectModel', on_delete=models.CASCADE)
 
 
 class TestDirectModel(models.Model):
diff --git a/django_guardian.egg-info/PKG-INFO b/django_guardian.egg-info/PKG-INFO
index 410badf..a1090a9 100644
--- a/django_guardian.egg-info/PKG-INFO
+++ b/django_guardian.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-guardian
-Version: 1.4.4
+Version: 1.4.8
 Summary: Implementation of per object permissions for Django.
 Home-page: http://github.com/django-guardian/django-guardian
 Author: Lukasz Balcerzak
@@ -8,6 +8,120 @@ Author-email: lukaszbalcerzak at gmail.com
 License: BSD
 Download-URL: https://github.com/django-guardian/django-guardian/tags
 Description: ===============
+        django-guardian
+        ===============
+        
+        .. image:: https://travis-ci.org/django-guardian/django-guardian.svg?branch=devel
+          :target: https://travis-ci.org/django-guardian/django-guardian
+        
+        ``django-guardian`` is an implementation of per object permissions [1]_ on top
+        of Django's authorization backend
+        
+        Documentation
+        -------------
+        
+        Online documentation is available at https://django-guardian.readthedocs.io/.
+        
+        Requirements
+        ------------
+        
+        * Python 2.7 or 3.4+
+        * A supported version of Django (currently 1.8+)
+        
+        Travis CI tests on Django version 1.8, 1.10, and 1.11.
+        
+        Installation
+        ------------
+        
+        To install ``django-guardian`` simply run::
+        
+            pip install django-guardian
+        
+        Configuration
+        -------------
+        
+        We need to hook ``django-guardian`` into our project.
+        
+        1. Put ``guardian`` into your ``INSTALLED_APPS`` at settings module:
+        
+        .. code:: python
+        
+            INSTALLED_APPS = (
+             ...
+             'guardian',
+            )
+           
+        2. Add extra authorization backend to your ``settings.py``:
+        
+        .. code:: python
+        
+            AUTHENTICATION_BACKENDS = (
+                'django.contrib.auth.backends.ModelBackend', # default
+                'guardian.backends.ObjectPermissionBackend',
+            )
+        
+        3. Create ``guardian`` database tables by running::
+        
+             python manage.py migrate
+        
+        Usage
+        -----
+        
+        After installation and project hooks we can finally use object permissions
+        with Django_.
+        
+        Lets start really quickly:
+        
+        .. code:: python
+        
+              >>> from django.contrib.auth.models import User, Group
+              >>> jack = User.objects.create_user('jack', 'jack at example.com', 'topsecretagentjack')
+              >>> admins = Group.objects.create(name='admins')
+              >>> jack.has_perm('change_group', admins)
+              False
+              >>> from guardian.models import UserObjectPermission
+              >>> UserObjectPermission.objects.assign_perm('change_group', jack, obj=admins)
+              <UserObjectPermission: admins | jack | change_group>
+              >>> jack.has_perm('change_group', admins)
+              True
+        
+        Of course our agent jack here would not be able to *change_group* globally:
+        
+        .. code:: python
+        
+            >>> jack.has_perm('change_group')
+            False
+        
+        Admin integration
+        -----------------
+        
+        Replace ``admin.ModelAdmin`` with ``GuardedModelAdmin`` for those models
+        which should have object permissions support within admin panel.
+        
+        For example:
+        
+        .. code:: python
+        
+            from django.contrib import admin
+            from myapp.models import Author
+            from guardian.admin import GuardedModelAdmin
+        
+            # Old way:
+            #class AuthorAdmin(admin.ModelAdmin):
+            #    pass
+        
+            # With object permissions support
+            class AuthorAdmin(GuardedModelAdmin):
+                pass
+        
+            admin.site.register(Author, AuthorAdmin)
+        
+        
+        .. [1] Great paper about this feature is available at `djangoadvent articles <https://github.com/djangoadvent/djangoadvent-articles/blob/master/1.2/06_object-permissions.rst>`_.
+        
+        .. _Django: http://www.djangoproject.com/
+        
+        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Web Environment
@@ -18,6 +132,6 @@ Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
 Classifier: Topic :: Security
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
diff --git a/django_guardian.egg-info/SOURCES.txt b/django_guardian.egg-info/SOURCES.txt
index dc659cc..be97474 100644
--- a/django_guardian.egg-info/SOURCES.txt
+++ b/django_guardian.egg-info/SOURCES.txt
@@ -1,4 +1,5 @@
 .gitignore
+.isort.cfg
 .travis.yml
 AUTHORS
 CHANGES
@@ -62,13 +63,27 @@ docs/userguide/index.rst
 docs/userguide/performance.rst
 docs/userguide/remove.rst
 example_project/__init__.py
-example_project/context_processors.py
 example_project/manage.py
 example_project/requirements.txt
 example_project/settings.py
 example_project/urls.py
+example_project/articles/__init__.py
+example_project/articles/admin.py
+example_project/articles/apps.py
+example_project/articles/models.py
+example_project/articles/tests.py
+example_project/articles/urls.py
+example_project/articles/views.py
+example_project/articles/migrations/0001_initial.py
+example_project/articles/migrations/0002_auto_20160622_1050.py
+example_project/articles/migrations/__init__.py
+example_project/articles/templates/articles/article_confirm_delete.html
+example_project/articles/templates/articles/article_detail.html
+example_project/articles/templates/articles/article_form.html
+example_project/articles/templates/articles/article_list.html
 example_project/core/__init__.py
 example_project/core/admin.py
+example_project/core/context_processors.py
 example_project/core/models.py
 example_project/core/migrations/0001_initial.py
 example_project/core/migrations/__init__.py
@@ -97,6 +112,7 @@ guardian/backends.py
 guardian/checks.py
 guardian/compat.py
 guardian/core.py
+guardian/ctypes.py
 guardian/decorators.py
 guardian/exceptions.py
 guardian/forms.py
@@ -105,7 +121,6 @@ guardian/mixins.py
 guardian/models.py
 guardian/shortcuts.py
 guardian/utils.py
-guardian/version.py
 guardian/conf/__init__.py
 guardian/conf/settings.py
 guardian/locale/es/LC_MESSAGES/django.mo
@@ -143,11 +158,6 @@ guardian/testapp/models.py
 guardian/testapp/testsettings.py
 guardian/testapp/migrations/0001_initial.py
 guardian/testapp/migrations/0002_logentrywithgroup.py
-guardian/testapp/migrations/0003_auto_20141124_0729.py
-guardian/testapp/migrations/0004_auto_20151112_2209.py
-guardian/testapp/migrations/0005_auto_20151217_2344.py
-guardian/testapp/migrations/0006_auto_20160221_1054.py
-guardian/testapp/migrations/0007_auto_20160309_0245.py
 guardian/testapp/migrations/__init__.py
 guardian/testapp/tests/__init__.py
 guardian/testapp/tests/conf.py
@@ -171,4 +181,6 @@ guardian/testapp/tests/urls.py
 guardian/testapp/tests/templates/404.html
 guardian/testapp/tests/templates/500.html
 guardian/testapp/tests/templates/blank.html
-guardian/testapp/tests/templates/dummy403.html
\ No newline at end of file
+guardian/testapp/tests/templates/dummy403.html
+guardian/testapp/tests/templates/dummy404.html
+guardian/testapp/tests/templates/list.html
\ No newline at end of file
diff --git a/django_guardian.egg-info/requires.txt b/django_guardian.egg-info/requires.txt
index 69eb504..ffe2fce 100644
--- a/django_guardian.egg-info/requires.txt
+++ b/django_guardian.egg-info/requires.txt
@@ -1,2 +1 @@
-Django >= 1.7
 six
diff --git a/docs/api/guardian.mixins.rst b/docs/api/guardian.mixins.rst
index b33738e..e46d5f9 100644
--- a/docs/api/guardian.mixins.rst
+++ b/docs/api/guardian.mixins.rst
@@ -26,3 +26,8 @@ PermissionRequiredMixin
 .. autoclass:: guardian.mixins.PermissionRequiredMixin
    :members:
 
+PermissionListMixin
+-----------------------
+
+.. autoclass:: guardian.mixins.PermissionListMixin
+   :members:
diff --git a/docs/conf.py b/docs/conf.py
index 5b2fc68..ee4c35f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -55,15 +55,14 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'django-guardian'
-copyright = u'2010-2013, Lukasz Balcerzak'
+copyright = u'Lukasz Balcerzak'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-from setuptools_scm import get_version
-version = get_version(root="..")
+version = guardian.__version__
 # The full version, including alpha/beta/rc tags.
 release = version
 
@@ -139,7 +138,7 @@ if not on_rtd:  # only import and set the theme if we're building docs locally
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
+# html_static_path = ['_static']
 
 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
 # using the given strftime format.
diff --git a/docs/configuration.rst b/docs/configuration.rst
index 64a11e2..88b0c34 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -135,3 +135,21 @@ Defaults to ``"guardian.management.get_init_anonymous_user"``.
 
 
 .. seealso:: :ref:`custom-user-model-anonymous`
+
+GUARDIAN_GET_CONTENT_TYPE
+-------------------------
+
+.. versionadded:: 1.5
+
+Guardian allows applications to supply a custom function to retrieve the
+content type from objects and models. This is useful when a class or class
+hierarchy uses the ``ContentType`` framework in an non-standard way. Most
+applications will not have to change this setting.
+
+As an example, when using ``django-polymorphic`` it's useful to use a
+permission on the base model which applies to all child models. In this case,
+the custom function would return the ``ContentType`` of the base class for
+polymorphic models and the regular model ``ContentType`` for non-polymorphic
+classes.
+
+Defaults to ``"guardian.ctypes.get_default_content_type"``.
\ No newline at end of file
diff --git a/docs/overview.rst b/docs/overview.rst
index 3911627..49b436f 100644
--- a/docs/overview.rst
+++ b/docs/overview.rst
@@ -29,9 +29,9 @@ Sources are available at `issue-tracker`_. You may also file a bug there.
 Alternate projects
 ------------------
 
-Django_ 1.2 still has *only* foundation for object permissions [1]_ and
+Django_ still has *only* foundation for object permissions [1]_ and
 ``django-guardian`` make use of new facilities and it is based on them.  There
-are some other pluggable applications which does *NOT* require latest 1.2
+are some other pluggable applications which does *NOT* require 1.2+
 version of Django_. For instance, there are great `django-authority`_ or
 `django-permissions`_ available out there.
 
diff --git a/docs/userguide/admin-integration.rst b/docs/userguide/admin-integration.rst
index bd20ed1..348e156 100644
--- a/docs/userguide/admin-integration.rst
+++ b/docs/userguide/admin-integration.rst
@@ -38,7 +38,6 @@ models within the admin. In example, look at following model:
         def __unicode__(self):
             return self.title
 
-        @models.permalink
         def get_absolute_url(self):
             return {'post_slug': self.slug}
 
diff --git a/docs/userguide/assign.rst b/docs/userguide/assign.rst
index b8c7bf9..f447dab 100644
--- a/docs/userguide/assign.rst
+++ b/docs/userguide/assign.rst
@@ -16,7 +16,7 @@ Let's assume we have following model:
     class Task(models.Model):
         summary = models.CharField(max_length=32)
         content = models.TextField()
-        reported_by = models.ForeignKey(User)
+        reported_by = models.ForeignKey(User, on_delete=models.CASCADE)
         created_at = models.DateTimeField(auto_now_add=True)
 
 ... and we want to be able to set custom permission *view_task*. We let Django
@@ -28,7 +28,7 @@ model could look like:
     class Task(models.Model):
         summary = models.CharField(max_length=32)
         content = models.TextField()
-        reported_by = models.ForeignKey(User)
+        reported_by = models.ForeignKey(User, on_delete=models.CASCADE)
         created_at = models.DateTimeField(auto_now_add=True)
 
         class Meta:
@@ -128,9 +128,10 @@ Another example:
     >>> userA.has_perm('change_company', companyB)
     False
     >>> userB = User.objects.create(username="User B")
+    >>> userB.groups.add(companyUserGroupB)
     >>> userB.has_perm('change_company', companyA)
     False
-    >>> userA.has_perm('change_company', companyB)
+    >>> userB.has_perm('change_company', companyB)
     True
 
 Assigning Permissions inside Signals
diff --git a/docs/userguide/custom-user-model.rst b/docs/userguide/custom-user-model.rst
index 81474e6..fb2045c 100644
--- a/docs/userguide/custom-user-model.rst
+++ b/docs/userguide/custom-user-model.rst
@@ -16,7 +16,7 @@ functionality. This can result in errors if guardian is imported into the models
 of the same app where the custom user model lives.
 
 To fix this, it is recommended to add the setting ``GUARDIAN_MONKEY_PATCH = False``
-in your settings.py and add the ``GuardianUserMixin`` to your custom user model.
+in your settings.py and subclass ``guardian.mixins.GuardianUserMixin`` in your custom user model.
 
 .. important::
     ``django-guardian`` relies **heavily** on the ``auth.User`` model.
diff --git a/docs/userguide/performance.rst b/docs/userguide/performance.rst
index 9e9b7a3..efbdacc 100644
--- a/docs/userguide/performance.rst
+++ b/docs/userguide/performance.rst
@@ -88,10 +88,10 @@ models:
         name = models.CharField(max_length=128, unique=True)
 
     class ProjectUserObjectPermission(UserObjectPermissionBase):
-        content_object = models.ForeignKey(Project)
+        content_object = models.ForeignKey(Project, on_delete=models.CASCADE)
 
     class ProjectGroupObjectPermission(GroupObjectPermissionBase):
-        content_object = models.ForeignKey(Project)
+        content_object = models.ForeignKey(Project, on_delete=models.CASCADE)
 
 
 .. important::
@@ -113,7 +113,7 @@ maintainence point of view, especially).
 .. _performance-prefetch:
 
 Prefetching permissions
--------------------
+-----------------------
... 3862 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-guardian.git



More information about the Python-modules-commits mailing list