Django

Code

Changeset 6082

Show
Ignore:
Timestamp:
09/09/07 21:29:42 (1 year ago)
Author:
jkocherhans
Message:

newforms-admin: Merged to [6081]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin

    • Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6050 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6081
  • django/branches/newforms-admin/AUTHORS

    r6054 r6082  
    8181    Michal Chruszcz <troll@pld-linux.org> 
    8282    Ian Clelland <clelland@gmail.com> 
     83    Russell Cloran <russell@rucus.net> 
    8384    colin@owlfish.com 
    8485    crankycoder@gmail.com 
  • django/branches/newforms-admin/django/core/management/base.py

    r6051 r6082  
     1import django 
    12from django.core.exceptions import ImproperlyConfigured 
    23from django.core.management.color import color_style 
     4import itertools 
     5from optparse import make_option, OptionParser 
    36import sys 
    47import os 
     8from traceback import print_exc 
    59 
    610class CommandError(Exception): 
     
    913class BaseCommand(object): 
    1014    # Metadata about this command. 
     15    option_list = ( 
     16        make_option('--settings', 
     17            help='The Python path to a settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.'), 
     18        make_option('--pythonpath', 
     19            help='A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".'), 
     20    ) 
    1121    help = '' 
    1222    args = '' 
     
    1929    def __init__(self): 
    2030        self.style = color_style() 
     31 
     32    def get_version(self): 
     33        """ 
     34        Returns the Django version, which should be correct for all built-in 
     35        Django commands. User-supplied commands should override this method. 
     36        """ 
     37        return django.get_version() 
     38 
     39    def usage(self): 
     40        usage = '%prog [options] ' + self.args 
     41        if self.help: 
     42            return '%s\n\n%s' % (usage, self.help) 
     43        else: 
     44            return usage 
     45 
     46    def create_parser(self, prog_name): 
     47        return OptionParser(prog=prog_name, 
     48                            usage=self.usage(), 
     49                            version=self.get_version(), 
     50                            option_list=self.option_list) 
     51 
     52    def print_help(self, args): 
     53        parser = self.create_parser(args[0]) 
     54        parser.print_help() 
     55 
     56    def run(self, args): 
     57        parser = self.create_parser(args[0]) 
     58        (options, args) = parser.parse_args(args[1:]) 
     59        if options.settings: 
     60            os.environ['DJANGO_SETTINGS_MODULE'] = options.settings 
     61        if options.pythonpath: 
     62            sys.path.insert(0, options.pythonpath) 
     63        try: 
     64            self.execute(*args, **options.__dict__) 
     65        except Exception, e: 
     66            print_exc() 
     67            parser.print_usage() 
    2168 
    2269    def execute(self, *args, **options): 
     
    70117 
    71118class AppCommand(BaseCommand): 
    72     args = '[appname ...]
     119    args = '<appname appname ...>
    73120 
    74121    def handle(self, *app_labels, **options): 
     
    91138 
    92139class LabelCommand(BaseCommand): 
    93     args = '[label ...]
     140    args = '<label label ...>
    94141    label = 'label' 
    95142 
     
    169216      new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR 
    170217      os.chmod(filename, new_permissions) 
    171  
  • django/branches/newforms-admin/django/core/management/commands/createcachetable.py

    r5984 r6082  
    33class Command(LabelCommand): 
    44    help = "Creates the table needed to use the SQL cache backend." 
    5     args = "[tablename]
     5    args = "<tablename>
    66    label = 'tablename' 
    77 
  • django/branches/newforms-admin/django/core/management/commands/dumpdata.py

    r5918 r6082  
    11from django.core.management.base import BaseCommand, CommandError 
    22 
     3from optparse import make_option 
     4 
    35class Command(BaseCommand): 
     6    option_list = BaseCommand.option_list + ( 
     7        make_option('--format', default='json', dest='format', 
     8            help='Specifies the output serialization format for fixtures'), 
     9        make_option('--indent', default=None, dest='indent', type='int', 
     10            help='Specifies the indent level to use when pretty-printing output'), 
     11    ) 
    412    help = 'Output the contents of the database as a fixture of the given format.' 
    5     args = '[--format] [--indent] [appname ...]' 
     13    args = '[appname ...]' 
    614 
    715    def handle(self, *app_labels, **options): 
  • django/branches/newforms-admin/django/core/management/commands/flush.py

    r6014 r6082  
    11from django.core.management.base import NoArgsCommand, CommandError 
    22from django.core.management.color import no_style 
     3from optparse import make_option 
    34 
    45class Command(NoArgsCommand): 
     6    option_list = NoArgsCommand.option_list + ( 
     7        make_option('--verbosity', action='store', dest='verbosity', default='1', 
     8            type='choice', choices=['0', '1', '2'], 
     9            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
     10        make_option('--noinput', action='store_false', dest='interactive', default=True, 
     11            help='Tells Django to NOT prompt the user for input of any kind.'), 
     12    ) 
    513    help = "Executes ``sqlflush`` on the current database." 
    6     args = '[--verbosity] [--noinput]' 
    714 
    815    def handle_noargs(self, **options): 
  • django/branches/newforms-admin/django/core/management/commands/loaddata.py

    r5984 r6082  
    11from django.core.management.base import BaseCommand 
    22from django.core.management.color import no_style 
     3from optparse import make_option 
    34import sys 
    45import os 
     
    1011 
    1112class Command(BaseCommand): 
     13    option_list = BaseCommand.option_list + ( 
     14        make_option('--verbosity', action='store', dest='verbosity', default='1', 
     15            type='choice', choices=['0', '1', '2'], 
     16            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
     17    ) 
    1218    help = 'Installs the named fixture(s) in the database.' 
    13     args = "[--verbosity] fixture, fixture, ...
     19    args = "fixture [fixture ...]
    1420 
    1521    def handle(self, *fixture_labels, **options): 
  • django/branches/newforms-admin/django/core/management/commands/reset.py

    r5918 r6082  
    11from django.core.management.base import AppCommand, CommandError 
    22from django.core.management.color import no_style 
     3from optparse import make_option 
    34 
    45class Command(AppCommand): 
     6    option_list = AppCommand.option_list + ( 
     7        make_option('--noinput', action='store_false', dest='interactive', default=True, 
     8            help='Tells Django to NOT prompt the user for input of any kind.'), 
     9    ) 
    510    help = "Executes ``sqlreset`` for the given app(s) in the current database." 
    6     args = '[--noinput] [appname ...]' 
     11    args = '[appname ...]' 
    712 
    813    output_transaction = True 
  • django/branches/newforms-admin/django/core/management/commands/runfcgi.py

    r5918 r6082  
    1515        from django.core.servers.fastcgi import runfastcgi 
    1616        runfastcgi(args) 
     17         
     18    def usage(self): 
     19        from django.core.servers.fastcgi import FASTCGI_HELP 
     20        return FASTCGI_HELP 
  • django/branches/newforms-admin/django/core/management/commands/runserver.py

    r6051 r6082  
    11from django.core.management.base import BaseCommand, CommandError 
     2from optparse import make_option 
    23import os 
    34import sys 
    45 
    56class Command(BaseCommand): 
     7    option_list = BaseCommand.option_list + ( 
     8        make_option('--noreload', action='store_false', dest='use_reloader', default=True, 
     9            help='Tells Django to NOT use the auto-reloader.'), 
     10        make_option('--adminmedia', dest='admin_media_path', default='', 
     11            help='Specifies the directory from which to serve admin media.'), 
     12    ) 
    613    help = "Starts a lightweight Web server for development." 
    7     args = '[--noreload] [--adminmedia=ADMIN_MEDIA_PATH] [optional port number, or ipaddr:port]' 
     14    args = '[optional port number, or ipaddr:port]' 
    815 
    916    # Validation is called explicitly each time the server is reloaded. 
  • django/branches/newforms-admin/django/core/management/commands/shell.py

    r5918 r6082  
    11from django.core.management.base import NoArgsCommand 
     2from optparse import make_option 
    23 
    34class Command(NoArgsCommand): 
     5    option_list = NoArgsCommand.option_list + ( 
     6        make_option('--plain', action='store_true', dest='plain', 
     7            help='Tells Django to use plain Python, not IPython.'), 
     8    ) 
    49    help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available." 
    5     args = '[--plain]' 
    610 
    711    requires_model_validation = False 
  • django/branches/newforms-admin/django/core/management/commands/syncdb.py

    r5984 r6082  
    11from django.core.management.base import NoArgsCommand 
    22from django.core.management.color import no_style 
     3from optparse import make_option 
    34import sys 
    45 
     
    910 
    1011class Command(NoArgsCommand): 
     12    option_list = NoArgsCommand.option_list + ( 
     13        make_option('--verbosity', action='store', dest='verbosity', default='1', 
     14            type='choice', choices=['0', '1', '2'], 
     15            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
     16        make_option('--noinput', action='store_false', dest='interactive', default=True, 
     17            help='Tells Django to NOT prompt the user for input of any kind.'), 
     18    ) 
    1119    help = "Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created." 
    12     args = '[--verbosity] [--noinput]' 
    1320 
    1421    def handle_noargs(self, **options): 
  • django/branches/newforms-admin/django/core/management/commands/test.py

    r5918 r6082  
    11from django.core.management.base import BaseCommand 
     2from optparse import make_option 
    23import sys 
    34 
    45class Command(BaseCommand): 
     6    option_list = BaseCommand.option_list + ( 
     7        make_option('--verbosity', action='store', dest='verbosity', default='1', 
     8            type='choice', choices=['0', '1', '2'], 
     9            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
     10        make_option('--noinput', action='store_false', dest='interactive', default=True, 
     11            help='Tells Django to NOT prompt the user for input of any kind.'), 
     12    ) 
    513    help = 'Runs the test suite for the specified applications, or the entire site if no apps are specified.' 
    6     args = '[--verbosity] [--noinput] [appname ...]' 
     14    args = '[appname ...]' 
    715 
    816    requires_model_validation = False 
  • django/branches/newforms-admin/django/core/management/commands/testserver.py

    r5918 r6082  
    11from django.core.management.base import BaseCommand 
    22 
     3from optparse import make_option 
     4 
    35class Command(BaseCommand): 
     6    option_list = BaseCommand.option_list + ( 
     7        make_option('--verbosity', action='store', dest='verbosity', default='1', 
     8            type='choice', choices=['0', '1', '2'], 
     9            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
     10    ) 
    411    help = 'Runs a development server with data from the given fixture(s).' 
    512    args = '[fixture ...]' 
  • django/branches/newforms-admin/django/core/management/__init__.py

    r5918 r6082  
    1919    """ 
    2020    Calls the given command, with the given options and args/kwargs. 
    21      
     21 
    2222    This is the primary API you should use for calling specific commands. 
    23      
     23 
    2424    Some examples: 
    2525        call_command('syncdb') 
     
    5353        return dict([(name, load_command_class(name)) for name in names]) 
    5454 
    55     def usage(self): 
     55    def print_help(self, argv): 
    5656        """ 
    57         Returns a usage string, for use with optparse. 
     57        Returns the help message, as a string. 
     58        """ 
     59        prog_name = os.path.basename(argv[0]) 
     60        usage = ['%s <subcommand> [options] [args]' % prog_name] 
     61        usage.append('Django command line tool, version %s' % django.get_version()) 
     62        usage.append("Type '%s help <subcommand>' for help on a specific subcommand." % prog_name) 
     63        usage.append('Available subcommands:') 
     64        commands = self.commands.keys() 
     65        commands.sort() 
     66        for cmd in commands: 
     67            usage.append('  %s' % cmd) 
     68        print '\n'.join(usage) 
    5869 
    59         The string doesn't include the options (e.g., "--verbose"), because 
    60         optparse puts those in automatically. 
     70    def fetch_command(self, subcommand, command_name): 
    6171        """ 
    62         usage = ["%prog command [options]\nactions:"] 
    63         commands = self.commands.items() 
    64         commands.sort() 
    65         for name, cmd in commands: 
    66             usage.append('  %s %s' % (name, cmd.args)) 
    67             usage.extend(textwrap.wrap(cmd.help, initial_indent='    ', subsequent_indent='    ')) 
    68             usage.append('') 
    69         return '\n'.join(usage[:-1]) # Cut off the last list element, an empty space. 
     72        Tries to fetch the given subcommand, printing a message with the 
     73        appropriate command called from the command line (usually 
     74        django-admin.py or manage.py) if it can't be found. 
     75        """ 
     76        try: 
     77            return self.commands[subcommand] 
     78        except KeyError: 
     79            sys.stderr.write("Unknown command: %r\nType '%s help' for usage.\n" % (subcommand, command_name)) 
     80            sys.exit(1) 
    7081 
    7182    def execute(self, argv=None): 
    7283        """ 
    73         Parses the given argv from the command line, determines which command 
    74         to run and runs the command
     84        Figures out which command is being run (the first arg), creates a parser 
     85        appropriate to that command, and runs it
    7586        """ 
    7687        if argv is None: 
    7788            argv = sys.argv 
     89        try: 
     90            command_name = argv[1] 
     91        except IndexError: 
     92            sys.stderr.write("Type '%s help' for usage.\n" % os.path.basename(argv[0])) 
     93            sys.exit(1) 
    7894 
    79         # Create the parser object and parse the command-line args. 
    80         # TODO: Ideally each Command class would register its own options for 
    81         # add_option(), but we'd need to figure out how to allow for multiple 
    82         # Commands using the same options. The optparse library gets in the way 
    83         # by checking for conflicts: 
    84         # http://docs.python.org/lib/optparse-conflicts-between-options.html 
    85         parser = OptionParser(usage=self.usage(), version=get_version()) 
    86         parser.add_option('--settings', 
    87             help='The Python path to a settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.') 
    88         parser.add_option('--pythonpath', 
    89             help='A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".') 
    90         parser.add_option('--plain', action='store_true', dest='plain', 
    91             help='When using "shell": Tells Django to use plain Python, not IPython.') 
    92         parser.add_option('--noinput', action='store_false', dest='interactive', default=True, 
    93             help='Tells Django to NOT prompt the user for input of any kind.') 
    94         parser.add_option('--noreload', action='store_false', dest='use_reloader', default=True, 
    95             help='When using "runserver": Tells Django to NOT use the auto-reloader.') 
    96         parser.add_option('--format', default='json', dest='format', 
    97             help='Specifies the output serialization format for fixtures') 
    98         parser.add_option('--indent', default=None, dest='indent', 
    99             type='int', help='Specifies the indent level to use when pretty-printing output') 
    100         parser.add_option('--verbosity', action='store', dest='verbosity', default='1', 
    101             type='choice', choices=['0', '1', '2'], 
    102             help='Verbosity level; 0=minimal output, 1=normal output, 2=all output') 
    103         parser.add_option('--adminmedia', dest='admin_media_path', default='', 
    104             help='When using "runserver": Specifies the directory from which to serve admin media.') 
    105         options, args = parser.parse_args(argv[1:]) 
    106  
    107         # If the 'settings' or 'pythonpath' options were submitted, activate those. 
    108         if options.settings: 
    109             os.environ['DJANGO_SETTINGS_MODULE'] = options.settings 
    110         if options.pythonpath: 
    111             sys.path.insert(0, options.pythonpath) 
    112  
    113         # Run the appropriate command. 
    114         try: 
    115             command_name = args[0] 
    116         except IndexError: 
    117             sys.stderr.write("Type '%s --help' for usage.\n" % os.path.basename(argv[0])) 
    118             sys.exit(1) 
    119         try: 
    120             command = self.commands[command_name] 
    121         except KeyError: 
    122             sys.stderr.write("Unknown command: %r\nType '%s --help' for usage.\n" % (command_name, os.path.basename(argv[0]))) 
    123             sys.exit(1) 
    124         command.execute(*args[1:], **options.__dict__) 
     95        if command_name == 'help': 
     96            if len(argv) > 2: 
     97                self.fetch_command(argv[2], argv[0]).print_help(argv[2:]) 
     98            else: 
     99                self.print_help(argv) 
     100        # Special-cases: We want 'django-admin.py --version' and 
     101        # 'django-admin.py --help' to work, for backwards compatibility. 
     102        elif argv[1:] == ['--version']: 
     103            print django.get_version() 
     104        elif argv[1:] == ['--help']: 
     105            self.print_help(argv) 
     106        else: 
     107            self.fetch_command(command_name, argv[0]).run(argv[1:]) 
    125108 
    126109class ProjectManagementUtility(ManagementUtility): 
  • django/branches/newforms-admin/django/core/servers/fastcgi.py

    r4940 r6082  
    1818__all__ = ["runfastcgi"] 
    1919 
    20 FASTCGI_HELP = r"""runfcgi: 
     20FASTCGI_HELP = r""" 
    2121  Run this project as a fastcgi (or some other protocol supported 
    2222  by flup) application. To do this, the flup package from 
    2323  http://www.saddi.com/software/flup/ is required. 
    2424 
    25 Usage: 
    26    django-admin.py runfcgi --settings=yourproject.settings [fcgi settings] 
    27    manage.py runfcgi [fcgi settings] 
     25   runfcgi [options] [fcgi settings] 
    2826 
    2927Optional Fcgi settings: (setting=value) 
  • django/branches/newforms-admin/django/core/validators.py

    r5918 r6082  
    1010 
    1111import urllib2 
    12 from django.conf import settings 
    13 from django.utils.translation import ugettext as _, ugettext_lazy, ungettext 
    14 from django.utils.functional import Promise, lazy 
    15 from django.utils.encoding import force_unicode 
    1612import re 
    1713try: 
     
    1915except ImportError: 
    2016    from django.utils._decimal import Decimal, DecimalException    # Python 2.3 
     17 
     18from django.conf import settings 
     19from django.utils.translation import ugettext as _, ugettext_lazy, ungettext 
     20from django.utils.functional import Promise, lazy 
     21from django.utils.encoding import force_unicode 
    2122 
    2223_datere = r'\d{4}-\d{1,2}-\d{1,2}' 
     
    149150    except ValueError, e: 
    150151        msg = _('Invalid date: %s') % _(str(e)) 
    151         raise ValidationError, msg     
     152        raise ValidationError, msg 
    152153 
    153154def isValidANSIDate(field_data, all_data): 
     
    252253    except: # urllib2.URLError, httplib.InvalidURL, etc. 
    253254        raise ValidationError, _("The URL %s is a broken link.") % field_data 
    254          
     255 
    255256def isValidUSState(field_data, all_data): 
    256257    "Checks that the given string is a valid two-letter U.S. state abbreviation" 
     
    381382 
    382383    def __call__(self, field_data, all_data): 
    383         # Try to make the value numeric. If this fails, we assume another  
     384        # Try to make the value numeric. If this fails, we assume another 
    384385        # validator will catch the problem. 
    385386        try: 
     
    387388        except ValueError: 
    388389            return 
    389              
     390 
    390391        # Now validate 
    391392        if self.lower and self.upper and (val < self.lower or val > self.upper): 
     
    424425            raise ValidationError, _("Please enter a valid decimal number.") 
    425426 
    426         pieces = str(val).split('.') 
     427        pieces = str(val).lstrip("-").split('.') 
    427428        decimals = (len(pieces) == 2) and len(pieces[1]) or 0 
    428429        digits = len(pieces[0]) 
  • django/branches/newforms-admin/django/db/models/fields/__init__.py

    r6056 r6082  
     1import datetime 
     2import os 
     3import time 
     4try: 
     5    import decimal 
     6except ImportError: 
     7    from django.utils import _decimal as decimal    # for Python 2.3 
     8 
    19from django.db import get_creation_module 
    210from django.db.models import signals 
     
    1321from django.utils.encoding import smart_unicode, force_unicode, smart_str 
    1422from django.utils.maxlength import LegacyMaxlength 
    15 import datetime, os, time 
    16 try: 
    17     import decimal 
    18 except ImportError: 
    19     from django.utils import _decimal as decimal    # for Python 2.3 
    2023 
    2124class NOT_PROVIDED: 
     
    381384    def save_form_data(self, instance, data): 
    382385        setattr(instance, self.name, data) 
    383          
     386 
    384387    def formfield(self, form_class=forms.CharField, **kwargs): 
    385388        "Returns a django.newforms.Field instance for this database Field." 
     
    784787        if data: 
    785788            getattr(instance, "save_%s_file" % self.name)(data.filename, data.content, save=False) 
    786          
     789 
    787790    def formfield(self, **kwargs): 
    788791        defaults = {'form_class': forms.FileField} 
    789         # If a file has been provided previously, then the form doesn't require  
     792        # If a file has been provided previously, then the form doesn't require 
    790793        # that a new file is provided this time. 
    791794        if 'initial' in kwargs: 
     
    917920        if 'db_index' not in kwargs: 
    918921            kwargs['db_index'] = True 
    919         Field.__init__(self, *args, **kwargs) 
    920  
    921     def get_manipulator_field_objs(self): 
    922         return [oldforms.TextField] 
     922        super(SlugField, self).__init__(*args, **kwargs) 
    923923 
    924924class SmallIntegerField(IntegerField): 
  • django/branches/newforms-admin/django/newforms/fields.py

    r5918 r6082  
    191191        except DecimalException: 
    192192            raise ValidationError(ugettext('Enter a number.')) 
    193         pieces = str(value).split('.') 
     193        pieces = str(value).lstrip("-").split('.') 
    194194        decimals = (len(pieces) == 2) and len(pieces[1]) or 0 
    195195        digits = len(pieces[0]) 
     
    354354        self.filename = filename 
    355355        self.content = content 
    356          
     356 
    357357    def __unicode__(self): 
    358358        """ 
     
    397397            raise ValidationError(ugettext(u"Upload a valid image. The file you uploaded was either not an image or a corrupted image.")) 
    398398        return f 
    399          
     399 
    400400class URLField(RegexField): 
    401401    def __init__(self, max_length=None, min_length=None, verify_exists=False, 
     
    527527    """ 
    528528    A Field that aggregates the logic of multiple Fields. 
    529      
     529 
    530530    Its clean() method takes a "decompressed" list of values, which are then 
    531531    cleaned into a single value according to self.fields. Each value in 
  • django/branches/newforms-admin/django/views/generic/date_based.py

    r5918 r6082  
     1import datetime 
     2import time 
     3 
    14from django.template import loader, RequestContext 
    25from django.core.exceptions import ObjectDoesNotExist 
     
    47from django.db.models.fields import DateTimeField 
    58from django.http import Http404, HttpResponse 
    6 import datetime, time 
    79 
    810def archive_index(request, queryset, date_field, num_latest=15, 
     
    7779        raise Http404 
    7880    if make_object_list: 
    79         object_list = queryset.filter(**lookup_kwargs).order_by(date_field) 
     81        object_list = queryset.filter(**lookup_kwargs) 
    8082    else: 
    8183        object_list = [] 
  • django/branches/newforms-admin/docs/contributing.txt

    r5984 r6082  
    122122      English than in code. Indentation is the most common example; it's hard to 
    123123      read patches when the only difference in code is that it's indented. 
     124 
     125        * When creating patches, always run ``svn diff`` from the top-level 
     126          ``trunk`` directory -- i.e., the one that contains ``django``, ``docs``, 
     127          ``tests``, ``AUTHORS``, etc. This makes it easy for other people to apply 
     128          your patches. 
    124129 
    125130    * Attach patches to a ticket in the `ticket tracker`_, using the "attach file" 
  • django/branches/newforms-admin/docs/django-admin.txt

    r6051 r6082  
    3636===== 
    3737 
    38 ``django-admin.py action [options]`` 
    39  
    40 ``manage.py action [options]`` 
    41  
    42 ``action`` should be one of the actions listed in this document. ``options``, 
    43 which is optional, should be zero or more of the options listed in this 
    44 document. 
    45  
    46 Run ``django-admin.py --help`` to display a help message that includes a terse 
    47 list of all available actions and options. 
    48  
    49 Most actions take a list of ``appname``s. An ``appname`` is the basename of the 
    50 package containing your models. For example, if your ``INSTALLED_APPS`` 
    51 contains the string ``'mysite.blog'``, the ``appname`` is ``blog``. 
    52  
    53 Available actions 
    54 ================= 
    55  
    56 adminindex [appname appname ...] 
     38``django-admin.py <subcommand> [options]`` 
     39 
     40``manage.py <subcommand> [options]`` 
     41 
     42``subcommand`` should be one of the subcommands listed in this document. 
     43``options``, which is optional, should be zero or more of the options available 
     44for the given subcommand. 
     45 
     46Getting runtime help 
     47-------------------- 
     48 
     49In Django 0.96, run ``django-admin.py --help`` to display a help message that 
     50includes a terse list of all available subcommands and options. 
     51 
     52In the Django development version, run ``django-admin.py help`` to display a 
     53list of all available subcommands. Run ``django-admin.py help <subcommand>`` 
     54to display a description of the given subcommand and a list of its available 
     55options. 
     56 
     57App names 
     58--------- 
     59 
     60Many subcommands take a list of "app names." An "app name" is the basename of 
     61the package containing your models. For example, if your ``INSTALLED_APPS`` 
     62contains the string ``'mysite.blog'``, the app name is ``blog``. 
     63 
     64Determining the version 
     65----------------------- 
     66 
     67Run ``django-admin.py --version`` to display the current Django version. 
     68 
     69Examples of output:: 
     70 
     71        0.95 
     72    0.96 
     73    0.97-pre-SVN-6069 
     74 
     75Available subcommands 
     76===================== 
     77 
     78adminindex <appname appname ...> 
    5779-------------------------------- 
    5880 
    59 Prints the admin-index template snippet for the given appnames
     81Prints the admin-index template snippet for the given app name(s)
    6082 
    6183Use admin-index template snippets if you want to customize the look and feel of 
     
    6486.. _Tutorial 2: ../tutorial02/ 
    6587 
    66 createcachetable [tablename] 
     88createcachetable <tablename> 
    6789---------------------------- 
    6890 
    6991Creates a cache table named ``tablename`` for use with the database cache 
    70 backend. See the `cache documentation`_ for more information. 
     92backend. See the `cache documentation`_ for more information. 
    7193 
    7294.. _cache documentation: ../cache/ 
     
    101123if you're ever curious to see the full list of defaults. 
    102124 
    103 dumpdata [appname appname ...] 
     125dumpdata <appname appname ...> 
    104126------------------------------ 
    105127 
    106 Output to standard output all data in the database associated with the named 
     128Outputs to standard output all data in the database associated with the named 
    107129application(s). 
    108130 
    109 By default, the database will be dumped in JSON format. If you want the output 
    110 to be in another format, use the ``--format`` option (e.g., ``format=xml``). 
    111 You may specify any Django serialization backend (including any user specified 
    112 serialization backends named in the ``SERIALIZATION_MODULES`` setting). The 
    113 ``--indent`` option can be used to pretty-print the output. 
    114  
    115131If no application name is provided, all installed applications will be dumped. 
    116132 
    117133The output of ``dumpdata`` can be used as input for ``loaddata``. 
     134 
     135--format 
     136~~~~~~~~ 
     137 
     138By default, ``dumpdata`` will format its output in JSON, but you can use the 
     139``--format`` option to specify another format. Currently supported formats are 
     140listed in `Serialization formats`_. 
     141 
     142Example usage:: 
     143 
     144    django-admin.py dumpdata --format=xml 
     145 
     146.. _Serialization formats: ../serialization/#serialization-formats 
     147 
     148--indent 
     149~~~~~~~~ 
     150 
     151By default, ``dumpdata`` will output all data on a single line. This isn't easy 
     152for humans to read, so you can use the ``--indent`` option to pretty-print the 
     153output with a number of indentation spaces. 
     154 
     155Example usage:: 
     156 
     157    django-admin.py dumpdata --indent=4 
    118158 
    119159flush 
    120160----- 
    121161 
    122 Return the database to the state it was in immediately after syncdb was 
     162Returns the database to the state it was in immediately after syncdb was 
    123163executed. This means that all data will be removed from the database, any 
    124164post-synchronization handlers will be re-executed, and the ``initial_data`` 
     
    131171tables that are represented by Django models and are activated in 
    132172``INSTALLED_APPS``. 
     173 
     174--noinput 
     175~~~~~~~~~ 
     176 
     177Use the ``--noinput`` option to suppress all user prompting, such as 
     178"Are you sure?" confirmation messages. This is useful if ``django-admin.py`` 
     179is being executed as an unattended, automated script. 
     180 
     181--verbosity 
     182~~~~~~~~~~~ 
     183 
     184Use ``--verbosity`` to specify the amount of notification and debug information 
     185that ``django-admin.py`` should print to the console. 
     186 
     187        * ``0`` means no input. 
     188        * ``1`` means normal input (default). 
     189        * ``2`` means verbose input. 
     190 
     191Example usage:: 
     192 
     193    django-admin.py flush --verbosity=2 
    133194 
    134195inspectdb 
     
    173234only works in PostgreSQL and with certain types of MySQL tables. 
    174235 
    175 loaddata [fixture fixture ...] 
     236loaddata <fixture fixture ...> 
    176237------------------------------ 
    177238 
    178239Searches for and loads the contents of the named fixture into the database. 
    179240 
    180 A *Fixture* is a collection of files that contain the serialized contents of 
    181 the database. Each fixture has a unique name; however, the files that 
    182 comprise the fixture can be distributed over multiple directories, in 
    183 multiple applications. 
     241A *fixture* is a collection of files that contain the serialized contents of 
     242the database. Each fixture has a unique name, and the files that comprise the 
     243fixture can be distributed over multiple directories, in multiple applications. 
    184244 
    185245Django will search in three locations for fixtures: 
     
    241301    defer checking of row constraints until a transaction is committed. 
    242302 
    243 reset [appname appname ...] 
     303--verbosity 
     304~~~~~~~~~~~ 
     305 
     306Use ``--verbosity`` to specify the amount of notification and debug information 
     307that ``django-admin.py`` should print to the console. 
     308 
     309        * ``0`` means no input. 
     310        * ``1`` means normal input (default). 
     311        * ``2`` means verbose input. 
     312 
     313Example usage:: 
     314 
     315    django-admin.py loaddata --verbosity=2 
     316