[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#770779: unblock: python-django-guardian/1.2.4-2



Or put another, the question is do we continue with the Debian fork, with extensive changes that have no testing outside Debian, or do we switch to the upstream git version where changes receive much better testing.

I have prepared (but not uploaded) the package using the git version, and verified it works. I didn't delete the old patches from debian/patches, because that would have made the diff larger, however I have removed the references from debian/patches/series.

Attached is the debdiff - most of it seems to be documentation fixes, and changes that are fix RC type bugs. Looking at the diff, it appears to include fixes for other RC issues I might have missed (e.g. renaming queryset function to get_queryset).

If this got uploaded to unstable, would it be considered acceptable for unblocking?

Thanks
--
Brian May <bam@debian.org>
diff -Nru django-guardian-1.2.4/AUTHORS django-guardian-1.2.4+git20141124/AUTHORS
--- django-guardian-1.2.4/AUTHORS	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/AUTHORS	2014-10-30 11:40:01.000000000 +1100
@@ -41,3 +41,12 @@
 - Warren Volz <warren@warrenvolz.com>
 - Omer Katz <omer.drow@gmail.com>
 - Vishal Lal <vish61@gmail.com>
+- Steven DeMartini <sjd@yelp.com>
+- zauddelig <zauddelig@gmail.com>
+- Remco Wendt <remco.wendt@gmail.com>
+- Kevin London <kevinlondon@gmail.com>
+- Kouhei Maeda <mkouhei@gmail.com>
+- Samuel Sutch <sam@sutch.net>
+- Morgan Aubert <morgan.aubert@zoho.com>
+- Brian May <brian@microcomaustralia.com.au>
+- Troy Grosfield <troy.grosfield@gmail.com>
diff -Nru django-guardian-1.2.4/CHANGES django-guardian-1.2.4+git20141124/CHANGES
--- django-guardian-1.2.4/CHANGES	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/CHANGES	2014-10-30 11:40:01.000000000 +1100
@@ -1,12 +1,21 @@
+Release DEV
+===========
+
+* Official Django 1.7 support (thanks Troy Grosfield and Brian May)
+* Allow to override ``PermissionRequiredMixin.get_permission_object``, part
+  of ``PermissionRequiredMixin.check_permissions`` method, responsible for
+  retrieving single object (Thanks zauddelig)
+* French translations (Thanks Morgan Aubert)
+
 Release 1.2.4 (Jul 14, 2014)
-===========================
+============================
 
 * Fixed another issue with custom primary keys at admin extensions (Thanks Omer
   Katz)
 
 
 Release 1.2.3 (Jul 14, 2014)
-===========================
+============================
 
 Unfortunately this was broken release not including any important changes.
 
diff -Nru django-guardian-1.2.4/debian/changelog django-guardian-1.2.4+git20141124/debian/changelog
--- django-guardian-1.2.4/debian/changelog	2014-09-03 13:35:48.000000000 +1000
+++ django-guardian-1.2.4+git20141124/debian/changelog	2014-11-24 12:57:38.000000000 +1100
@@ -1,3 +1,15 @@
+django-guardian (1.2.4+git20141124-0.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Use git version db61a57b7deb5a5da70bb0542f833ddac8e60653.
+  * Remove patches from debian/patches that are no longer required.
+  * Add fix for https://github.com/lukaszb/django-guardian/issues/284.
+  * Fix test errors. Closes: #769216.
+  * Increase standards version to 3.9.6.
+  * Requires Puthon >= 2.7.
+
+ -- Brian May <bam@debian.org>  Mon, 24 Nov 2014 12:05:20 +1100
+
 django-guardian (1.2.4-2) unstable; urgency=medium
 
   * Supported django 1.7 (Closes: #755598)
diff -Nru django-guardian-1.2.4/debian/control django-guardian-1.2.4+git20141124/debian/control
--- django-guardian-1.2.4/debian/control	2014-09-03 13:35:37.000000000 +1000
+++ django-guardian-1.2.4+git20141124/debian/control	2014-11-24 12:50:40.000000000 +1100
@@ -8,8 +8,8 @@
     python3-all, python3-setuptools, python3-django (>= 1.2),
     python3-mock (>= 0.7.2), python3-six,
     python3-sphinx,
-Standards-Version: 3.9.5
-X-Python-Version: >= 2.6
+Standards-Version: 3.9.6
+X-Python-Version: >= 2.7
 Homepage: http://github.com/lukaszb/django-guardian
 
 Package: python-django-guardian
diff -Nru django-guardian-1.2.4/debian/patches/add_migration.patch django-guardian-1.2.4+git20141124/debian/patches/add_migration.patch
--- django-guardian-1.2.4/debian/patches/add_migration.patch	1970-01-01 10:00:00.000000000 +1000
+++ django-guardian-1.2.4+git20141124/debian/patches/add_migration.patch	2014-11-24 12:50:40.000000000 +1100
@@ -0,0 +1,35 @@
+Index: django-guardian/guardian/testapp/migrations/0003_auto_20141123_1837.py
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ django-guardian/guardian/testapp/migrations/0003_auto_20141123_1837.py	2014-11-24 11:37:02.208412629 +1100
+@@ -0,0 +1,30 @@
++# -*- coding: utf-8 -*-
++from __future__ import unicode_literals
++
++from django.db import models, migrations
++import django.core.validators
++
++
++class Migration(migrations.Migration):
++
++    dependencies = [
++        ('testapp', '0002_logentrywithgroup'),
++    ]
++
++    operations = [
++        migrations.CreateModel(
++            name='NonIntPKModel',
++            fields=[
++                ('char_pk', models.CharField(max_length=128, serialize=False, primary_key=True)),
++            ],
++            options={
++            },
++            bases=(models.Model,),
++        ),
++        migrations.AlterField(
++            model_name='customuser',
++            name='username',
++            field=models.CharField(help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True, max_length=30, verbose_name='username', validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username.', 'invalid')]),
++            preserve_default=True,
++        ),
++    ]
diff -Nru django-guardian-1.2.4/debian/patches/series django-guardian-1.2.4+git20141124/debian/patches/series
--- django-guardian-1.2.4/debian/patches/series	2014-08-29 00:28:53.000000000 +1000
+++ django-guardian-1.2.4+git20141124/debian/patches/series	2014-11-24 12:50:40.000000000 +1100
@@ -1,10 +1,4 @@
 append_uncompressed_js_libraries.patch
-fixed_title_underline_too_short.patch
 remove_non_local_image_uri.patch
 python32.patch
-0005-Move-migrations-to-south_migrations.patch
-0006-Inlude-staticfiles-in-INSTALLED_APPS-only-once.patch
-0007-Name-INSTALLED_APPS-consistantly.patch
-0008-Fix-conflicting-related_name.patch
-0009-Add-Django-1.7-migrations.patch
-0010-Add-MIDDLEWARE_CLASSES-setting.patch
+add_migration.patch
diff -Nru django-guardian-1.2.4/docs/userguide/check.rst django-guardian-1.2.4+git20141124/docs/userguide/check.rst
--- django-guardian-1.2.4/docs/userguide/check.rst	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/docs/userguide/check.rst	2014-10-30 11:40:01.000000000 +1100
@@ -3,14 +3,14 @@
 Check object permissions
 ========================
 
-Once we have :ref:`assigned some permissions <assign>` we can get into detail
-about verifying permissions of user or group.
+Once we have :ref:`assigned some permissions <assign>`, we can get into detail
+about verifying permissions of a user or group.
 
 Standard way
 ------------
 
-Normally to check if Joe is permitted to change ``Site`` objects we do this by
-calling ``has_perm`` method on an ``User`` instance::
+Normally to check if Joe is permitted to change ``Site`` objects we
+call ``has_perm`` method on an ``User`` instance::
 
     >>> joe.has_perm('sites.change_site')
     False
@@ -22,7 +22,7 @@
     >>> joe.has_perm('sites.change_site', site)
     False
 
-Lets assign permission and check again::
+Let's assign permission and check again::
 
     >>> from guardian.shortcuts import assign_perm
     >>> assign_perm('sites.change_site', joe, site)
@@ -31,20 +31,20 @@
     >>> joe.has_perm('sites.change_site', site)
     True
 
-This uses backend we have specified at settings module (see
-:ref:`configuration`). More on a backend itself can be found at
+This uses the backend we have specified at settings module (see
+:ref:`configuration`). More on the backend can be found at
 :class:`Backend's API <guardian.backends.ObjectPermissionBackend>`.
 
 Inside views
 ------------
 
-Besides of standard ``has_perm`` method ``django-guardian`` provides some useful
-helpers for object permission checks.
+Aside from the standard ``has_perm`` method, ``django-guardian``
+provides some useful helpers for object permission checks.
 
 get_perms
 ~~~~~~~~~
 
-To check permissions we can use quick-and-dirty shortcut::
+To check permissions we can use a quick-and-dirty shortcut::
 
     >>> from guardian.shortcuts import get_perms
     >>>
@@ -57,9 +57,9 @@
 
 It is probably better to use standard ``has_perm`` method. But for ``Group``
 instances it is not as easy and ``get_perms`` could be handy here as it accepts
-both ``User`` and ``Group`` instances. And if we need to do some more work we
-can use lower level ``ObjectPermissionChecker`` class which is described in next
-section.
+both ``User`` and ``Group`` instances. If we need to do some more work, we
+can use lower level ``ObjectPermissionChecker`` class which is described in 
+the next section.
 
 get_objects_for_user
 ~~~~~~~~~~~~~~~~~~~~
@@ -93,7 +93,7 @@
 ObjectPermissionChecker
 ~~~~~~~~~~~~~~~~~~~~~~~
 
-At the ``core`` module of ``django-guardian`` there is a 
+At the ``core`` module of ``django-guardian``, there is a 
 :class:`guardian.core.ObjectPermissionChecker` which checks permission of
 user/group for specific object. It caches results so it may be used at part of
 codes where we check permissions more than once.
diff -Nru django-guardian-1.2.4/docs/userguide/performance.rst django-guardian-1.2.4+git20141124/docs/userguide/performance.rst
--- django-guardian-1.2.4/docs/userguide/performance.rst	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/docs/userguide/performance.rst	2014-10-30 11:40:01.000000000 +1100
@@ -4,7 +4,7 @@
 ===================
 
 It is important to remember that by default ``django-guardian`` uses generic
-foreign keys to retain relation with any Django model. For most cases it's
+foreign keys to retain relation with any Django model. For most cases, it's
 probably good enough, however if we have a lot of queries being spanned and
 our database seems to be choking it might be a good choice to use *direct*
 foreign keys. Let's start with quick overview of how generic solution work and
@@ -60,8 +60,8 @@
 
 
 
-As there are no real foreing keys pointing at the target model this solution
-might not be enough for all cases. In example if we try to build an issues
+As there are no real foreign keys pointing at the target model, this solution
+might not be enough for all cases. For example, if we try to build an issues
 tracking service and we'd like to be able to support thousands of users and
 their project/tickets, object level permission checks can be slow with this
 generic solution.
@@ -99,13 +99,13 @@
    ``content_object`` as underlying queries depends on it.
 
 
-from now on ``guardian`` will figure out that ``Project`` model has direct
+From now on, ``guardian`` will figure out that ``Project`` model has direct
 relation for user/group object permissions and will use those models. It is
-also possible to use only user or only group based direct relation, however it
+also possible to use only user or only group-based direct relation, however it
 is discouraged (it's not consistent and might be a quick road to hell from the
-mainteinence point of view, especially).
+maintainence point of view, especially).
 
 .. note::
    By defining direct relation models we can also tweak that object permission
-   model, i.e. by adding some fields
+   model, i.e. by adding some fields.
 
diff -Nru django-guardian-1.2.4/.gitignore django-guardian-1.2.4+git20141124/.gitignore
--- django-guardian-1.2.4/.gitignore	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/.gitignore	2014-10-30 11:40:01.000000000 +1100
@@ -21,3 +21,5 @@
 
 # WebDAV remote filesystem
 .DAV
+.project
+.pydevproject
diff -Nru django-guardian-1.2.4/guardian/admin.py django-guardian-1.2.4+git20141124/guardian/admin.py
--- django-guardian-1.2.4/guardian/admin.py	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/admin.py	2014-10-30 11:40:01.000000000 +1100
@@ -60,8 +60,14 @@
     group_owned_objects_field = 'group'
     include_object_permissions_urls = True
 
-    def queryset(self, request):
-        qs = super(GuardedModelAdminMixin, self).queryset(request)
+    def get_queryset(self, request):
+        # Prefer the Django >= 1.6 interface but maintain
+        # backward compatibility
+        method = getattr(
+            super(GuardedModelAdminMixin, self), 'get_queryset',
+            super(GuardedModelAdminMixin, self).queryset)
+        qs = method(request)
+
         if request.user.is_superuser:
             return qs
 
@@ -76,6 +82,12 @@
             qs = qs.filter(**filters)
         return qs
 
+    # Allow queryset method as fallback for Django versions < 1.6
+    # for versions >= 1.6 this is taken care of by Django itself
+    # and triggers a warning message automatically.
+    import django
+    if django.VERSION < (1, 6):
+        queryset = get_queryset
 
     def get_urls(self):
         """
diff -Nru django-guardian-1.2.4/guardian/backends.py django-guardian-1.2.4+git20141124/guardian/backends.py
--- django-guardian-1.2.4/guardian/backends.py	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/backends.py	2014-10-30 11:40:01.000000000 +1100
@@ -54,7 +54,7 @@
         if not user_obj.is_active:
             return False
 
-        if len(perm.split('.')) > 1:
+        if '.' in perm:
             app_label, perm = perm.split('.')
             if app_label != obj._meta.app_label:
                 raise WrongAppError("Passed perm has app label of '%s' and "
diff -Nru django-guardian-1.2.4/guardian/__init__.py django-guardian-1.2.4+git20141124/guardian/__init__.py
--- django-guardian-1.2.4/guardian/__init__.py	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/__init__.py	2014-10-30 11:40:01.000000000 +1100
@@ -3,7 +3,7 @@
 """
 from __future__ import unicode_literals
 
-VERSION = (1, 2, 4)
+VERSION = (1, 2, 5, 'dev')
 
 __version__ = '.'.join((str(each) for each in VERSION[:4]))
 
Binary files /tmp/brian/IaCqRoOnPv/django-guardian-1.2.4/guardian/locale/fr/LC_MESSAGES/django.mo and /tmp/brian/xLNr2LDvzR/django-guardian-1.2.4+git20141124/guardian/locale/fr/LC_MESSAGES/django.mo differ
diff -Nru django-guardian-1.2.4/guardian/locale/fr/LC_MESSAGES/django.po django-guardian-1.2.4+git20141124/guardian/locale/fr/LC_MESSAGES/django.po
--- django-guardian-1.2.4/guardian/locale/fr/LC_MESSAGES/django.po	1970-01-01 10:00:00.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/locale/fr/LC_MESSAGES/django.po	2014-10-30 11:40:01.000000000 +1100
@@ -0,0 +1,156 @@
+# French translation of django-guardian.
+# This file is distributed under the same license as the PACKAGE package.
+# Translator: Morgan Aubert <morgan.aubert@zoho.com>, 2014.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: django-guardian 1.2.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-12 19:50+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Morgan Aubert <morgan.aubert@zoho.com>\n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#: admin.py:32 admin.py:42 forms.py:55
+msgid "Permissions"
+msgstr "Permissions"
+
+#: admin.py:127
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:12
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_group.html:14
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_group.html:25
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_user.html:14
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_user.html:25
+#: templates/admin/guardian/model/change_form.html:5
+#: templates/admin/guardian/model/obj_perms_manage.html:17
+#: templates/admin/guardian/model/obj_perms_manage_group.html:14
+#: templates/admin/guardian/model/obj_perms_manage_group.html:25
+#: templates/admin/guardian/model/obj_perms_manage_user.html:14
+#: templates/admin/guardian/model/obj_perms_manage_user.html:25
+msgid "Object permissions"
+msgstr "Permissions de l'objet"
+
+#: admin.py:218 admin.py:271
+msgid "Permissions saved."
+msgstr "Permissions sauvegardées."
+
+#: admin.py:395
+msgid "User identification"
+msgstr "Identification de l'utilisateur"
+
+#: admin.py:397
+msgid "This user does not exist"
+msgstr "Cet utilisateur n'existe pas"
+
+#: admin.py:398
+msgid "Enter a value compatible with User.USERNAME_FIELD"
+msgstr "Entrez une valeur compatible avec User.USERNAME_FIELD"
+
+#: admin.py:421
+msgid "This group does not exist"
+msgstr "Ce groupe n'existe pas"
+
+#: models.py:46
+msgid "object ID"
+msgstr "ID de l'objet"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:8
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_group.html:10
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_user.html:10
+#: templates/admin/guardian/model/obj_perms_manage.html:13
+#: templates/admin/guardian/model/obj_perms_manage_group.html:10
+#: templates/admin/guardian/model/obj_perms_manage_user.html:10
+msgid "Home"
+msgstr "Accueil"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:21
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:82
+msgid "Please correct the error below."
+msgid_plural "Please correct the errors below."
+msgstr[0] "Veuillez corriger l'erreur ci-dessous."
+msgstr[1] "Veuillez corriger les erreurs ci-dessous."
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:25
+#: templates/admin/guardian/model/obj_perms_manage.html:32
+msgid "Users"
+msgstr "Utilisateurs"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:28
+#: templates/admin/guardian/model/obj_perms_manage.html:38
+msgid "User permissions"
+msgstr "Permissions des utilisateurs"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:33
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_user.html:34
+#: templates/admin/guardian/model/obj_perms_manage.html:41
+#: templates/admin/guardian/model/obj_perms_manage_user.html:30
+msgid "User"
+msgstr "Utilisateur"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:37
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:98
+#: templates/admin/guardian/model/obj_perms_manage.html:45
+#: templates/admin/guardian/model/obj_perms_manage.html:99
+msgid "Action"
+msgstr "Action"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:54
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:115
+#: templates/admin/guardian/model/obj_perms_manage.html:62
+#: templates/admin/guardian/model/obj_perms_manage.html:116
+msgid "Edit"
+msgstr "Modifier"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:70
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_user.html:15
+#: templates/admin/guardian/model/obj_perms_manage.html:73
+#: templates/admin/guardian/model/obj_perms_manage_user.html:15
+msgid "Manage user"
+msgstr "Gérer l'utilisateur"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:86
+#: templates/admin/guardian/model/obj_perms_manage.html:86
+msgid "Groups"
+msgstr "Groupes"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:89
+#: templates/admin/guardian/model/obj_perms_manage.html:92
+msgid "Group permissions"
+msgstr "Permissions des groupes"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:94
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_group.html:34
+#: templates/admin/guardian/model/obj_perms_manage.html:95
+#: templates/admin/guardian/model/obj_perms_manage_group.html:30
+msgid "Group"
+msgstr "Groupe"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage.html:132
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_group.html:15
+#: templates/admin/guardian/model/obj_perms_manage.html:127
+#: templates/admin/guardian/model/obj_perms_manage_group.html:15
+msgid "Manage group"
+msgstr "Gérer le groupe"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_group.html:28
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_user.html:28
+#: templates/admin/guardian/model/obj_perms_manage_group.html:27
+#: templates/admin/guardian/model/obj_perms_manage_user.html:27
+msgid "Object"
+msgstr "Objet"
+
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_group.html:45
+#: templates/admin/guardian/contrib/grappelli/obj_perms_manage_user.html:45
+#: templates/admin/guardian/model/obj_perms_manage_group.html:37
+#: templates/admin/guardian/model/obj_perms_manage_user.html:37
+msgid "Save"
+msgstr "Sauvegarder"
+
+#: templates/admin/guardian/model/obj_perms_manage.html:28
+#: templates/admin/guardian/model/obj_perms_manage.html:82
+msgid "Please correct the errors below."
+msgstr "Veuillez corriger les erreurs ci-dessous."
diff -Nru django-guardian-1.2.4/guardian/mixins.py django-guardian-1.2.4+git20141124/guardian/mixins.py
--- django-guardian-1.2.4/guardian/mixins.py	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/mixins.py	2014-10-30 11:40:01.000000000 +1100
@@ -58,7 +58,9 @@
 
     If a `get_object()` method is defined either manually or by including
     another mixin (for example ``SingleObjectMixin``) or ``self.object`` is
-    defiend then the permission will be tested against that specific instance.
+    defined then the permission will be tested against that specific instance,
+    alternatively you can specify `get_permission_object()` method if ``self.object`` 
+    or `get_object()` does not return the object against you want to test permission 
 
     .. note:
        Testing of a permission against a specific object instance requires an
@@ -116,6 +118,10 @@
         *Default*: ``False``,  If accept_global_perms would be set to True, then
          mixing would first check for global perms, if none found, then it will
          proceed to check object level permissions.
+    ``PermissionRequiredMixin.permission_object``
+         *Default*: ``None``, object against which test the permission; if None fallback
+         to ``self.get_permission_object()`` which return ``self.get_object()`` 
+         or ``self.object`` by default.
 
     """
     ### default class view settings
@@ -125,7 +131,7 @@
     return_403 = False
     raise_exception = False
     accept_global_perms = False
-
+    permission_object = None
     def get_required_permissions(self, request=None):
         """
         Returns list of permissions in format *<app_label>.<codename>* that
@@ -144,7 +150,13 @@
                 "'<app_label>.<permission codename>' but is set to '%s' instead"
                 % self.permission_required)
         return perms
-
+    
+    def get_permission_object(self):
+        if self.permission_object:
+            return self.permission_object
+        return (hasattr(self, 'get_object') and self.get_object()
+                or getattr(self, 'object', None))
+                
     def check_permissions(self, request):
         """
         Checks if *request.user* has all permissions returned by
@@ -152,8 +164,7 @@
 
         :param request: Original request.
         """
-        obj = (hasattr(self, 'get_object') and self.get_object()
-            or getattr(self, 'object', None))
+        obj = self.get_permission_object()
 
 
         forbidden = get_403_or_None(request,
diff -Nru django-guardian-1.2.4/guardian/shortcuts.py django-guardian-1.2.4+git20141124/guardian/shortcuts.py
--- django-guardian-1.2.4/guardian/shortcuts.py	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/shortcuts.py	2014-10-30 11:40:01.000000000 +1100
@@ -11,15 +11,15 @@
 from django.shortcuts import _get_queryset
 from itertools import groupby
 
-from guardian.compat import get_user_model
 from guardian.compat import basestring
+from guardian.compat import get_user_model
 from guardian.core import ObjectPermissionChecker
 from guardian.exceptions import MixedContentTypeError
 from guardian.exceptions import WrongAppError
 from guardian.utils import get_anonymous_user
+from guardian.utils import get_group_obj_perms_model
 from guardian.utils import get_identity
 from guardian.utils import get_user_obj_perms_model
-from guardian.utils import get_group_obj_perms_model
 import warnings
 
 def assign_perm(perm, user_or_group, obj=None):
@@ -283,6 +283,7 @@
                 groups[group] = sorted(get_perms(group, obj))
         return groups
 
+
 def get_objects_for_user(user, perms, klass=None, use_groups=True, any_perm=False,
         with_superuser=True):
     """
@@ -304,7 +305,7 @@
     :param any_perm: if True, any of permission in sequence is accepted
     :param with_superuser: if ``True`` returns the entire queryset if not it will
     only return objects the user has explicit permissions.
-    
+
     :raises MixedContentTypeError: when computed content type for ``perms``
       and/or ``klass`` clashes.
     :raises WrongAppError: if cannot compute app label for given ``perms``/
@@ -432,16 +433,17 @@
 
     values = user_obj_perms_queryset.values_list(fields[0], flat=True)
     if user_model.objects.is_generic():
-        values = [int(v) for v in values]
+        values = list(values)
     objects = queryset.filter(pk__in=values)
     if use_groups:
         values = groups_obj_perms_queryset.values_list(fields[0], flat=True)
         if group_model.objects.is_generic():
-            values = [int(v) for v in values]
+            values = list(values)
         objects |= queryset.filter(pk__in=values)
 
     return objects
 
+
 def get_objects_for_group(group, perms, klass=None, any_perm=False):
     """
     Returns queryset of objects for which a given ``group`` has *all*
diff -Nru django-guardian-1.2.4/guardian/testapp/migrations/0001_initial.py django-guardian-1.2.4+git20141124/guardian/testapp/migrations/0001_initial.py
--- django-guardian-1.2.4/guardian/testapp/migrations/0001_initial.py	1970-01-01 10:00:00.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/testapp/migrations/0001_initial.py	2014-10-30 11:40:01.000000000 +1100
@@ -0,0 +1,117 @@
+from __future__ import unicode_literals
+
+import datetime
+
+from django.conf import settings
+import django.core.validators
+from django.db import models, migrations
+import django.utils.timezone
+import guardian.mixins
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('auth', '0001_initial'),
+        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='CustomUser',
+            fields=[
+                ('password', models.CharField(max_length=128, verbose_name='password')),
+                ('last_login', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last login')),
+                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
+                ('username', models.CharField(help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True, max_length=30, verbose_name='username', validators=[django.core.validators.RegexValidator('^[\\w.@-]+$', 'Enter a valid username.', 'invalid')])),
+                ('first_name', models.CharField(max_length=30, verbose_name='first name', blank=True)),
+                ('last_name', models.CharField(max_length=30, verbose_name='last name', blank=True)),
+                ('email', models.EmailField(max_length=75, verbose_name='email address', blank=True)),
+                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
+                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
+                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
+                ('custom_id', models.AutoField(serialize=False, primary_key=True)),
+                ('groups', models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Group', blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of his/her group.', verbose_name='groups')),
+                ('user_permissions', models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Permission', blank=True, help_text='Specific permissions for this user.', verbose_name='user permissions')),
+            ],
+            options={
+                'abstract': False,
+                'verbose_name': 'user',
+                'verbose_name_plural': 'users',
+            },
+            bases=(models.Model, guardian.mixins.GuardianUserMixin),
+        ),
+        migrations.CreateModel(
+            name='Mixed',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('name', models.CharField(unique=True, max_length=128)),
+            ],
+            options={
+            },
+            bases=(models.Model,),
+        ),
+        migrations.CreateModel(
+            name='MixedGroupObjectPermission',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('content_object', models.ForeignKey(to='testapp.Mixed')),
+                ('group', models.ForeignKey(to='auth.Group')),
+                ('permission', models.ForeignKey(to='auth.Permission')),
+            ],
+            options={
+                'abstract': False,
+            },
+            bases=(models.Model,),
+        ),
+        migrations.CreateModel(
+            name='Project',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('name', models.CharField(unique=True, max_length=128)),
+                ('created_at', models.DateTimeField(default=datetime.datetime.now)),
+            ],
+            options={
+                'get_latest_by': 'created_at',
+            },
+            bases=(models.Model,),
+        ),
+        migrations.CreateModel(
+            name='ProjectGroupObjectPermission',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('content_object', models.ForeignKey(to='testapp.Project')),
+                ('group', models.ForeignKey(to='auth.Group')),
+                ('permission', models.ForeignKey(to='auth.Permission')),
+            ],
+            options={
+                'abstract': False,
+            },
+            bases=(models.Model,),
+        ),
+        migrations.CreateModel(
+            name='ProjectUserObjectPermission',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('content_object', models.ForeignKey(to='testapp.Project')),
+                ('permission', models.ForeignKey(to='auth.Permission')),
+                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
+            ],
+            options={
+                'abstract': False,
+            },
+            bases=(models.Model,),
+        ),
+        migrations.AlterUniqueTogether(
+            name='projectuserobjectpermission',
+            unique_together=set([('user', 'permission', 'content_object')]),
+        ),
+        migrations.AlterUniqueTogether(
+            name='projectgroupobjectpermission',
+            unique_together=set([('group', 'permission', 'content_object')]),
+        ),
+        migrations.AlterUniqueTogether(
+            name='mixedgroupobjectpermission',
+            unique_together=set([('group', 'permission', 'content_object')]),
+        ),
+    ]
\ No newline at end of file
diff -Nru django-guardian-1.2.4/guardian/testapp/migrations/0002_logentrywithgroup.py django-guardian-1.2.4+git20141124/guardian/testapp/migrations/0002_logentrywithgroup.py
--- django-guardian-1.2.4/guardian/testapp/migrations/0002_logentrywithgroup.py	1970-01-01 10:00:00.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/testapp/migrations/0002_logentrywithgroup.py	2014-10-30 11:40:01.000000000 +1100
@@ -0,0 +1,25 @@
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('auth', '0001_initial'),
+        ('admin', '0001_initial'),
+        ('testapp', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='LogEntryWithGroup',
+            fields=[
+                ('logentry_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='admin.LogEntry')),
+                ('group', models.ForeignKey(blank=True, to='auth.Group', null=True)),
+            ],
+            options={
+            },
+            bases=('admin.logentry',),
+        ),
+    ]
\ No newline at end of file
diff -Nru django-guardian-1.2.4/guardian/testapp/models.py django-guardian-1.2.4+git20141124/guardian/testapp/models.py
--- django-guardian-1.2.4/guardian/testapp/models.py	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/testapp/models.py	2014-10-30 11:40:01.000000000 +1100
@@ -58,7 +58,16 @@
 class LogEntryWithGroup(LogEntry):
     group = models.ForeignKey('auth.Group', null=True, blank=True)
 
+
+class NonIntPKModel(models.Model):
+    """
+    Model for testing whether get_objects_for_user will work when the objects to
+    be returned have non-integer primary keys.
+    """
+    char_pk = models.CharField(primary_key=True, max_length=128)
+
+
 if django.VERSION > (1, 5):
     from django.contrib.auth.models import AbstractUser
     class CustomUser(AbstractUser, GuardianUserMixin):
-        custom_id = models.AutoField(primary_key=True)
\ No newline at end of file
+        custom_id = models.AutoField(primary_key=True)
diff -Nru django-guardian-1.2.4/guardian/testapp/tests/shortcuts_test.py django-guardian-1.2.4+git20141124/guardian/testapp/tests/shortcuts_test.py
--- django-guardian-1.2.4/guardian/testapp/tests/shortcuts_test.py	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/testapp/tests/shortcuts_test.py	2014-10-30 11:40:01.000000000 +1100
@@ -20,6 +20,7 @@
 from guardian.exceptions import MixedContentTypeError
 from guardian.exceptions import NotUserNorGroup
 from guardian.exceptions import WrongAppError
+from guardian.testapp.models import NonIntPKModel
 from guardian.testapp.tests.core_test import ObjectPermissionTestCase
 from guardian.models import Group, Permission
 
@@ -607,6 +608,60 @@
             set(objects.values_list('id', flat=True)),
             set(ctypes[i].id for i in [0, 1, 3, 4]))
 
+    def test_non_integer_primary_key(self):
+        """
+        Verify that the function works when the objects that should be returned
+        have non-integer primary keys.
+        """
+        obj_with_char_pk = NonIntPKModel.objects.create(char_pk='testprimarykey')
+        assign_perm('add_nonintpkmodel', self.user, obj_with_char_pk)
+
+        objects = get_objects_for_user(self.user, 'testapp.add_nonintpkmodel')
+        self.assertEqual(len(objects), 1)
+        self.assertTrue(isinstance(objects, QuerySet))
+        self.assertEqual(
+            set(objects.values_list('pk', flat=True)),
+            set([obj_with_char_pk.pk]))
+
+    def test_non_integer_primary_key_with_any_perm(self):
+        """
+        Verify that the function works with any_perm set to True when the
+        objects that should be returned have non-integer primary keys.
+        """
+        obj_with_char_pk = NonIntPKModel.objects.create(char_pk='testprimarykey')
+        assign_perm('add_nonintpkmodel', self.user, obj_with_char_pk)
+
+        objects = get_objects_for_user(
+            self.user,
+            ['testapp.add_nonintpkmodel', 'testapp.change_nonintpkmodel'],
+            any_perm=True)
+        self.assertEqual(len(objects), 1)
+        self.assertTrue(isinstance(objects, QuerySet))
+        self.assertEqual(
+            set(objects.values_list('pk', flat=True)),
+            set([obj_with_char_pk.pk]))
+
+    def test_non_integer_primary_key_with_group_values(self):
+        """
+        Verify that the function works when the objects that should be returned
+        have non-integer primary keys, and those objects are due to the user's
+        groups.
+        """
+        obj_with_char_pk = NonIntPKModel.objects.create(char_pk='testprimarykey')
+        assign_perm('add_nonintpkmodel', self.group, obj_with_char_pk)
+        self.user.groups.add(self.group)
+
+        objects = get_objects_for_user(
+            self.user,
+            ['testapp.add_nonintpkmodel', 'testapp.change_nonintpkmodel'],
+            any_perm=True)
+        self.assertEqual(len(objects), 1)
+        self.assertTrue(isinstance(objects, QuerySet))
+        self.assertEqual(
+            set(objects.values_list('pk', flat=True)),
+            set([obj_with_char_pk.pk]))
+
+
 class GetObjectsForGroup(TestCase):
     """
     Tests get_objects_for_group function.
diff -Nru django-guardian-1.2.4/guardian/testsettings.py django-guardian-1.2.4+git20141124/guardian/testsettings.py
--- django-guardian-1.2.4/guardian/testsettings.py	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/guardian/testsettings.py	2014-10-30 11:40:01.000000000 +1100
@@ -27,6 +27,14 @@
     'guardian.backends.ObjectPermissionBackend',
 )
 
+# this fixes warnings in django 1.7
+MIDDLEWARE_CLASSES = (
+    'django.middleware.common.CommonMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+)
+
 TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'
 
 DATABASES = {
diff -Nru django-guardian-1.2.4/LICENSE django-guardian-1.2.4+git20141124/LICENSE
--- django-guardian-1.2.4/LICENSE	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/LICENSE	2014-10-30 11:40:01.000000000 +1100
@@ -1,4 +1,4 @@
-Copyright (c) 2010-2013 Lukasz Balcerzak <lukaszbalcerzak@gmail.com>
+Copyright (c) 2010-2014 Lukasz Balcerzak <lukaszbalcerzak@gmail.com>
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff -Nru django-guardian-1.2.4/tox.ini django-guardian-1.2.4+git20141124/tox.ini
--- django-guardian-1.2.4/tox.ini	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/tox.ini	2014-10-30 11:40:01.000000000 +1100
@@ -18,6 +18,8 @@
     py33-django15,
     py33-django16,
     py33-django17,
+    py34-django16,
+    py34-django17,
     custom-user-model,
     no-tests-app,
     migrations,
@@ -64,7 +66,7 @@
 deps = django==1.6.2
 
 [django17]
-deps = https://www.djangoproject.com/m/releases/1.7/Django-1.7a2.tar.gz
+deps = django==1.7.1
 
 
 [testenv:py26-grappelli]
@@ -131,15 +133,23 @@
 basepython = python3.3
 deps = {[django17]deps}
 
+[testenv:py34-django16]
+basepython = python3.4
+deps = {[django16]deps}
+
+[testenv:py34-django17]
+basepython = python3.4
+deps = {[django17]deps}
+
 [testenv:custom-user-model]
-basepython = python3.3
+basepython = python3.4
 deps = {[django16]deps}
 changedir = example_project
 commands =
     {envpython} manage.py test guardian integration_tests --traceback
 
 [testenv:no-tests-app]
-basepython = python3.3
+basepython = python3.4
 deps = {[django16]deps}
 changedir = example_project
 setenv =
diff -Nru django-guardian-1.2.4/.travis.yml django-guardian-1.2.4+git20141124/.travis.yml
--- django-guardian-1.2.4/.travis.yml	2014-07-15 01:20:13.000000000 +1000
+++ django-guardian-1.2.4+git20141124/.travis.yml	2014-10-30 11:40:01.000000000 +1100
@@ -7,9 +7,9 @@
 env:
  - DJANGO_VERSION=1.2.7
  - DJANGO_VERSION=1.3.7
- - DJANGO_VERSION=1.4.10
- - DJANGO_VERSION=1.5.5
- - DJANGO_VERSION=1.6.2
+ - DJANGO_VERSION=1.4.16
+ - DJANGO_VERSION=1.5.11
+ - DJANGO_VERSION=1.6.8
 
 install:
   - pip install -q mock==0.8 Django==$DJANGO_VERSION coverage coveralls
@@ -33,5 +33,9 @@
         - python: 3.3
           env: DJANGO_VERSION=1.3.7
         - python: 3.3
-          env: DJANGO_VERSION=1.4.10
-
+          env: DJANGO_VERSION=1.4.16
+    include:
+        - python: 3.3
+          env: DJANGO_VERSION=1.7.1
+        - python: 3.4
+          env: DJANGO_VERSION=1.7.1

Reply to: