Ticket #17904: 17904.diff

File 17904.diff, 2.2 KB (added by Claude Paroz, 13 years ago)

Revert optimization of r16963

  • django/contrib/auth/management/__init__.py

    diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py
    index e792597..b516507 100644
    a b def create_permissions(app, created_models, verbosity, **kwargs):  
    3131    searched_perms = list()
    3232    # The codenames and ctypes that should exist.
    3333    ctypes = set()
    34     ctypes_for_models = ContentType.objects.get_for_models(*app_models)
    35     for klass, ctype in ctypes_for_models.iteritems():
     34    for klass in app_models:
     35        ctype = ContentType.objects.get_for_model(klass)
    3636        ctypes.add(ctype)
    3737        for perm in _get_all_permissions(klass._meta):
    3838            searched_perms.append((ctype, perm))
  • tests/modeltests/proxy_models/models.py

    diff --git a/tests/modeltests/proxy_models/models.py b/tests/modeltests/proxy_models/models.py
    index c033117..49fd87d 100644
    a b class MyPerson(Person):  
    4444    class Meta:
    4545        proxy = True
    4646        ordering = ["name"]
     47        permissions = (
     48            ("display_users", "May display users information"),
     49        )
    4750
    4851    objects = SubManager()
    4952    other = PersonManager()
    class Improvement(Issue):  
    158161
    159162class ProxyImprovement(Improvement):
    160163    class Meta:
    161         proxy = True
    162  No newline at end of file
     164        proxy = True
  • tests/modeltests/proxy_models/tests.py

    diff --git a/tests/modeltests/proxy_models/tests.py b/tests/modeltests/proxy_models/tests.py
    index b332103..738e0db 100644
    a b class ProxyModelTests(TestCase):  
    167167        resp = [p.name for p in OtherPerson._default_manager.all()]
    168168        self.assertEqual(resp, ['barney', 'wilma'])
    169169
     170    def test_permissions_created(self):
     171        from django.contrib.auth.models import Permission
     172        try:
     173            Permission.objects.get(name="May display users information")
     174        except Permission.DoesNotExist:
     175            self.fail("The permission 'May display users information' has not been created")
     176
    170177    def test_proxy_model_signals(self):
    171178        """
    172179        Test save signals for proxy models
Back to Top