diff -urx '*.pyc' Django-1.4/django/contrib/auth/management/__init__.py /usr/local/filewave/python/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py
old
|
new
|
|
21 | 21 | return perms + list(opts.permissions) |
22 | 22 | |
23 | 23 | |
24 | | def create_permissions(app, created_models, verbosity, **kwargs): |
| 24 | def create_permissions(app, created_models, verbosity, db, **kwargs): |
25 | 25 | from django.contrib.contenttypes.models import ContentType |
26 | 26 | |
27 | 27 | app_models = get_models(app) |
… |
… |
|
32 | 32 | # The codenames and ctypes that should exist. |
33 | 33 | ctypes = set() |
34 | 34 | for klass in app_models: |
35 | | ctype = ContentType.objects.get_for_model(klass) |
| 35 | ctype = ContentType.objects.db_manager(db).get_for_model(klass) |
36 | 36 | ctypes.add(ctype) |
37 | 37 | for perm in _get_all_permissions(klass._meta): |
38 | 38 | searched_perms.append((ctype, perm)) |
… |
… |
|
40 | 40 | # Find all the Permissions that have a context_type for a model we're |
41 | 41 | # looking for. We don't need to check for codenames since we already have |
42 | 42 | # a list of the ones we're going to create. |
43 | | all_perms = set(auth_app.Permission.objects.filter( |
| 43 | all_perms = set(auth_app.Permission.objects.using(db).filter( |
44 | 44 | content_type__in=ctypes, |
45 | 45 | ).values_list( |
46 | 46 | "content_type", "codename" |
… |
… |
|
51 | 51 | for ctype, (codename, name) in searched_perms |
52 | 52 | if (ctype.pk, codename) not in all_perms |
53 | 53 | ] |
54 | | auth_app.Permission.objects.bulk_create(objs) |
| 54 | auth_app.Permission.objects.using(db).bulk_create(objs) |
55 | 55 | if verbosity >= 2: |
56 | 56 | for obj in objs: |
57 | 57 | print "Adding permission '%s'" % obj |
diff -urx '*.pyc' Django-1.4/django/contrib/contenttypes/management.py /usr/local/filewave/python/lib/python2.7/site-packages/django/contrib/contenttypes/management.py
old
|
new
|
|
2 | 2 | from django.db.models import get_apps, get_models, signals |
3 | 3 | from django.utils.encoding import smart_unicode |
4 | 4 | |
5 | | def update_contenttypes(app, created_models, verbosity=2, **kwargs): |
| 5 | def update_contenttypes(app, created_models, verbosity, db, **kwargs): |
6 | 6 | """ |
7 | 7 | Creates content types for models in the given app, removing any model |
8 | 8 | entries that no longer have a matching model class. |
… |
… |
|
20 | 20 | # Get all the content types |
21 | 21 | content_types = dict( |
22 | 22 | (ct.model, ct) |
23 | | for ct in ContentType.objects.filter(app_label=app_label) |
| 23 | for ct in ContentType.objects.using(db).filter(app_label=app_label) |
24 | 24 | ) |
25 | 25 | to_remove = [ |
26 | 26 | ct |