Ticket #8348: 8348-default_to_all_apps.diff
File 8348-default_to_all_apps.diff, 8.2 KB (added by , 16 years ago) |
---|
-
django/core/management/commands/sqlall.py
1 1 from django.core.management.base import AppCommand 2 2 3 3 class Command(AppCommand): 4 help = "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s)." 4 help = "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given "+\ 5 "app name(s), or all the apps if none specified." 5 6 6 7 output_transaction = True 7 8 -
django/core/management/commands/sqlcustom.py
1 1 from django.core.management.base import AppCommand 2 2 3 3 class Command(AppCommand): 4 help = "Prints the custom table modifying SQL statements for the given app name(s)." 4 help = "Prints the custom table modifying SQL statements for the given app name(s), "+ \ 5 "or all the apps if none specified." 5 6 6 7 output_transaction = True 7 8 -
django/core/management/commands/sqlsequencereset.py
1 1 from django.core.management.base import AppCommand 2 2 3 3 class Command(AppCommand): 4 help = 'Prints the SQL statements for resetting sequences for the given app name(s).' 4 help = "Prints the SQL statements for resetting sequences for the given app name(s), "+ \ 5 "or all the apps if none specified." 5 6 output_transaction = True 6 7 7 8 def handle_app(self, app, **options): -
django/core/management/commands/sql.py
1 1 from django.core.management.base import AppCommand 2 2 3 3 class Command(AppCommand): 4 help = "Prints the CREATE TABLE SQL statements for the given app name(s)." 4 help = "Prints the CREATE TABLE SQL statements for the given app name(s), "+ \ 5 "or all the apps if none specified." 5 6 6 7 output_transaction = True 7 8 -
django/core/management/commands/sqlreset.py
1 1 from django.core.management.base import AppCommand 2 2 3 3 class Command(AppCommand): 4 help = "Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s)." 4 help = "Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s), "+ \ 5 "or all the apps if none specified." 5 6 6 7 output_transaction = True 7 8 -
django/core/management/commands/sqlclear.py
1 1 from django.core.management.base import AppCommand 2 2 3 3 class Command(AppCommand): 4 help = "Prints the DROP TABLE SQL statements for the given app name(s)." 4 help = "Prints the DROP TABLE SQL statements for the given app name(s), "+ \ 5 "or all the apps if none specified." 5 6 6 7 output_transaction = True 7 8 -
django/core/management/commands/sqlindexes.py
1 1 from django.core.management.base import AppCommand 2 2 3 3 class Command(AppCommand): 4 help = "Prints the CREATE INDEX SQL statements for the given model module name(s)." 4 help = "Prints the CREATE INDEX SQL statements for the given app name(s), "+ \ 5 "or all the apps if none specified." 5 6 6 7 output_transaction = True 7 8 -
django/core/management/commands/reset.py
7 7 make_option('--noinput', action='store_false', dest='interactive', default=True, 8 8 help='Tells Django to NOT prompt the user for input of any kind.'), 9 9 ) 10 help = "Executes ``sqlreset`` for the given app(s) in the current database." 10 help = "Executes ``sqlreset`` for the given app(s) in the current database, "+ \ 11 "or all the apps if none specified." 11 12 args = '[appname ...]' 12 13 13 14 output_transaction = True -
django/core/management/base.py
11 11 import django 12 12 from django.core.exceptions import ImproperlyConfigured 13 13 from django.core.management.color import color_style 14 from django.conf import settings 14 15 15 16 try: 16 17 set … … 271 272 ``handle_app()``, which will be called once for each application. 272 273 273 274 """ 274 args = ' <appname appname ...>'275 args = '[appname appname ...]' 275 276 276 277 def handle(self, *app_labels, **options): 277 278 from django.db import models 278 if not app_labels: 279 raise CommandError('Enter at least one appname.') 279 280 if not app_labels: # If no app given default to all apps 281 for full_app_name in settings.INSTALLED_APPS: 282 if full_app_name.startswith('django.contrib'): 283 candidate_label = full_app_name[ len('django.contrib.'): ] 284 else: 285 candidate_label = full_app_name 286 try: 287 models.get_app(candidate_label) 288 app_labels += (candidate_label,) 289 except ImproperlyConfigured: 290 # No models in this app, so skip it 291 pass 292 280 293 try: 281 294 app_list = [models.get_app(app_label) for app_label in app_labels] 282 295 except (ImproperlyConfigured, ImportError), e: -
tests/regressiontests/admin_scripts/tests.py
914 914 args = ['sqlall','--help'] 915 915 out, err = self.run_manage(args) 916 916 self.assertNoOutput(err) 917 self.assertOutput(out, "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).") 917 self.assertOutput(out, "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL "+\ 918 "statements for the given app name(s), or all the apps if none specified") 918 919 919 920 def test_base_command(self): 920 921 "User BaseCommands can execute when a label is provided" … … 974 975 self.assertOutput(out, "'>, options=[('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', '1')]") 975 976 976 977 def test_app_command_no_apps(self): 977 "User AppCommands raise an errorwhen no app name is provided"978 "User AppCommands defaults to all the apps when no app name is provided" 978 979 args = ['app_command'] 979 980 out, err = self.run_manage(args) 980 self.assertOutput(err, 'Error: Enter at least one appname.') 981 self.assertNoOutput(err) 982 self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.auth.models'") 983 self.assertOutput(out, "EXECUTE:AppCommand app=<module 'django.contrib.contenttypes.models'") 984 self.assertOutput(out, "EXECUTE:AppCommand app=<module 'admin_scripts.models'") 981 985 982 986 def test_app_command_multiple_apps(self): 983 987 "User AppCommands raise an error when multiple app names are provided"