Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added django.contrib.contenttypes.management.create_all_contenttypes(…

…) function for convenience

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4183 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5f36d9d562a7f78befbb045d529081995ba3097a 1 parent c50d333
Adrian Holovaty authored December 07, 2006
11  django/contrib/contenttypes/management.py
@@ -3,9 +3,9 @@
3 3
 """
4 4
 
5 5
 from django.dispatch import dispatcher
6  
-from django.db.models import get_models, signals
  6
+from django.db.models import get_apps, get_models, signals
7 7
 
8  
-def create_contenttypes(app, created_models, verbosity):
  8
+def create_contenttypes(app, created_models, verbosity=2):
9 9
     from django.contrib.contenttypes.models import ContentType
10 10
     app_models = get_models(app)
11 11
     if not app_models:
@@ -22,4 +22,11 @@ def create_contenttypes(app, created_models, verbosity):
22 22
             if verbosity >= 2:
23 23
                 print "Adding content type '%s | %s'" % (ct.app_label, ct.model)
24 24
 
  25
+def create_all_contenttypes(verbosity=2):
  26
+    for app in get_apps():
  27
+        create_contenttypes(app, None, verbosity)
  28
+
25 29
 dispatcher.connect(create_contenttypes, signal=signals.post_syncdb)
  30
+
  31
+if __name__ == "__main__":
  32
+    create_all_contenttypes()

0 notes on commit 5f36d9d

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