Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12999 -- Modified the contenttypes syncdb handler to use db ro…

…uter logic. Thanks to lsbardel for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1db672f34735e0338316062e511aa17d24108524 1 parent e5d23d8
Russell Keith-Magee authored March 10, 2010

Showing 1 changed file with 4 additions and 5 deletions. Show diff stats Hide diff stats

  1. 9  django/contrib/contenttypes/management.py
9  django/contrib/contenttypes/management.py
@@ -7,22 +7,21 @@ def update_contenttypes(app, created_models, verbosity=2, **kwargs):
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.
9 9
     """
10  
-    db = kwargs['db']
11 10
     ContentType.objects.clear_cache()
12  
-    content_types = list(ContentType.objects.using(db).filter(app_label=app.__name__.split('.')[-2]))
  11
+    content_types = list(ContentType.objects.filter(app_label=app.__name__.split('.')[-2]))
13 12
     app_models = get_models(app)
14 13
     if not app_models:
15 14
         return
16 15
     for klass in app_models:
17 16
         opts = klass._meta
18 17
         try:
19  
-            ct = ContentType.objects.using(db).get(app_label=opts.app_label,
20  
-                                                   model=opts.object_name.lower())
  18
+            ct = ContentType.objects.get(app_label=opts.app_label,
  19
+                                         model=opts.object_name.lower())
21 20
             content_types.remove(ct)
22 21
         except ContentType.DoesNotExist:
23 22
             ct = ContentType(name=smart_unicode(opts.verbose_name_raw),
24 23
                 app_label=opts.app_label, model=opts.object_name.lower())
25  
-            ct.save(using=db)
  24
+            ct.save()
26 25
             if verbosity >= 2:
27 26
                 print "Adding content type '%s | %s'" % (ct.app_label, ct.model)
28 27
     # The presence of any remaining content types means the supplied app has an

0 notes on commit 1db672f

Please sign in to comment.
Something went wrong with that request. Please try again.