Ticket #2333: contrib.patch
File contrib.patch, 3.2 KB (added by , 18 years ago) |
---|
-
contrib/contenttypes/management.py
5 5 from django.dispatch import dispatcher 6 6 from django.db.models import get_models, signals 7 7 8 def create_contenttypes(app, created_models ):8 def create_contenttypes(app, created_models, verbosity, interactive): 9 9 from django.contrib.contenttypes.models import ContentType 10 10 app_models = get_models(app) 11 11 if not app_models: … … 19 19 ct = ContentType(name=str(opts.verbose_name), 20 20 app_label=opts.app_label, model=opts.object_name.lower()) 21 21 ct.save() 22 print "Adding content type '%s | %s'" % (ct.app_label, ct.model) 22 if verbosity >= 2: 23 print "Adding content type '%s | %s'" % (ct.app_label, ct.model) 23 24 24 25 dispatcher.connect(create_contenttypes, signal=signals.post_syncdb) -
contrib/auth/management.py
16 16 perms.append((_get_permission_codename(action, opts), 'Can %s %s' % (action, opts.verbose_name))) 17 17 return perms + list(opts.permissions) 18 18 19 def create_permissions(app, created_models ):19 def create_permissions(app, created_models, verbosity, interactive): 20 20 from django.contrib.contenttypes.models import ContentType 21 21 from django.contrib.auth.models import Permission 22 22 app_models = get_models(app) … … 27 27 for codename, name in _get_all_permissions(klass._meta): 28 28 p, created = Permission.objects.get_or_create(codename=codename, content_type__pk=ctype.id, 29 29 defaults={'name': name, 'content_type': ctype}) 30 if created :30 if created and verbosity >= 2: 31 31 print "Adding permission '%s'" % p 32 32 33 def create_superuser(app, created_models ):33 def create_superuser(app, created_models, verbosity, interactive): 34 34 from django.contrib.auth.models import User 35 35 from django.contrib.auth.create_superuser import createsuperuser as do_create 36 if User in created_models :36 if User in created_models and interactive: 37 37 msg = "\nYou just installed Django's auth system, which means you don't have " \ 38 38 "any superusers defined.\nWould you like to create one now? (yes/no): " 39 39 confirm = raw_input(msg) -
contrib/sites/management.py
7 7 from django.contrib.sites.models import Site 8 8 from django.contrib.sites import models as site_app 9 9 10 def create_default_site(app, created_models ):10 def create_default_site(app, created_models, verbosity, interactive): 11 11 if Site in created_models: 12 print "Creating example.com Site object" 12 if verbosity >= 2: 13 print "Creating example.com Site object" 13 14 s = Site(domain="example.com", name="example.com") 14 15 s.save() 15 16