Ticket #25057: 25057_permission_for_view_without_locales.diff

File 25057_permission_for_view_without_locales.diff, 1.9 KB (added by Grigoriy Kramarenko, 9 years ago)
  • django/contrib/auth/management/__init__.py

    diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py
    index 6380d2f..670a2ad 100644
    a b def _get_all_permissions(opts, ctype):  
    2828def _get_builtin_permissions(opts):
    2929    """
    3030    Returns (codename, name) for all autogenerated permissions.
    31     By default, this is ('add', 'change', 'delete')
     31    By default, this is ('view', 'add', 'change', 'delete')
    3232    """
    3333    perms = []
    3434    for action in opts.default_permissions:
  • django/db/models/options.py

    diff --git a/django/db/models/options.py b/django/db/models/options.py
    index 368ac62..3f1f3c5 100644
    a b class Options(object):  
    106106        self.unique_together = []
    107107        self.index_together = []
    108108        self.select_on_save = False
    109         self.default_permissions = ('add', 'change', 'delete')
     109        self.default_permissions = ('view', 'add', 'change', 'delete')
    110110        self.permissions = []
    111111        self.object_name = None
    112112        self.app_label = app_label
  • tests/auth_tests/test_management.py

    diff --git a/tests/auth_tests/test_management.py b/tests/auth_tests/test_management.py
    index f45703f..3434d4d 100644
    a b class PermissionTestCase(TestCase):  
    570570        ]
    571571        create_permissions(auth_app_config, verbosity=0)
    572572
    573         # add/change/delete permission by default + custom permission
     573        # view/add/change/delete permission by default + custom permission
    574574        self.assertEqual(models.Permission.objects.filter(
    575575            content_type=permission_content_type,
    576         ).count(), 4)
     576        ).count(), 5)
    577577
    578578        models.Permission.objects.filter(content_type=permission_content_type).delete()
    579579        models.Permission._meta.default_permissions = []
Back to Top