Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12204 -- Corrected the use of :djadmin: links in the testing d…

…ocs, plus updated a lot of old-style markup in the django-admin docs. Thanks to Art_S for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11734 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c8514b570bb51347c2b3ffbc1df543ac2dfc7000 1 parent 632f12f
Russell Keith-Magee authored November 12, 2009
174  docs/ref/django-admin.txt
@@ -78,11 +78,9 @@ Examples of output::
78 78
 Displaying debug output
79 79
 -----------------------
80 80
 
81  
-.. django-admin-option:: --verbosity <amount>
82  
-
83  
-Use ``--verbosity`` to specify the amount of notification and debug information
  81
+Use :djadminopt:`--verbosity` to specify the amount of notification and debug information
84 82
 that ``django-admin.py`` should print to the console. For more details, see the
85  
-documentation for the :ref:`default options for django-admin.py <django-admin-verbosity>`.
  83
+documentation for the :djadminopt:`--verbosity` option.
86 84
 
87 85
 Available subcommands
88 86
 =====================
@@ -90,6 +88,8 @@ Available subcommands
90 88
 cleanup
91 89
 -------
92 90
 
  91
+.. django-admin:: cleanup
  92
+
93 93
 .. versionadded:: 1.0
94 94
 
95 95
 Can be run as a cronjob or directly to clean out old data from the database
@@ -98,17 +98,16 @@ Can be run as a cronjob or directly to clean out old data from the database
98 98
 compilemessages
99 99
 ---------------
100 100
 
  101
+.. django-admin:: compilemessages
  102
+
101 103
 .. versionchanged:: 1.0
102 104
    Before 1.0 this was the "bin/compile-messages.py" command.
103 105
 
104 106
 Compiles .po files created with ``makemessages`` to .mo files for use with
105 107
 the builtin gettext support. See :ref:`topics-i18n`.
106 108
 
107  
---locale
108  
-~~~~~~~~
109  
-
110  
-Use the ``--locale`` or ``-l`` option to specify the locale to process.
111  
-If not provided all locales are processed.
  109
+Use the :djadminopt:`--locale`` option to specify the locale to process.
  110
+If not provided, all locales are processed.
112 111
 
113 112
 Example usage::
114 113
 
@@ -117,7 +116,7 @@ Example usage::
117 116
 createcachetable
118 117
 ----------------
119 118
 
120  
-.. django-admin:: createcachetable <tablename>
  119
+.. django-admin:: createcachetable
121 120
 
122 121
 Creates a cache table named ``tablename`` for use with the database cache
123 122
 backend. See :ref:`topics-cache` for more information.
@@ -183,10 +182,10 @@ example, the default settings don't define ``ROOT_URLCONF``, so
183 182
 Note that Django's default settings live in ``django/conf/global_settings.py``,
184 183
 if you're ever curious to see the full list of defaults.
185 184
 
186  
-dumpdata
187  
---------
  185
+dumpdata <appname appname appname.Model ...>
  186
+--------------------------------------------
188 187
 
189  
-.. django-admin:: dumpdata <appname appname appname.Model ...>
  188
+.. django-admin:: dumpdata
190 189
 
191 190
 Outputs to standard output all data in the database associated with the named
192 191
 application(s).
@@ -215,18 +214,17 @@ directives::
215 214
 
216 215
     django-admin.py dumpdata --exclude=auth --exclude=contenttypes
217 216
 
218  
-
219 217
 .. django-admin-option:: --format <fmt>
220 218
 
221  
-    By default, ``dumpdata`` will format its output in JSON, but you can use the
222  
-    ``--format`` option to specify another format. Currently supported formats
223  
-    are listed in :ref:`serialization-formats`.
  219
+By default, ``dumpdata`` will format its output in JSON, but you can use the
  220
+``--format`` option to specify another format. Currently supported formats
  221
+are listed in :ref:`serialization-formats`.
224 222
 
225 223
 .. django-admin-option:: --indent <num>
226 224
 
227  
-    By default, ``dumpdata`` will output all data on a single line. This isn't
228  
-    easy for humans to read, so you can use the ``--indent`` option to
229  
-    pretty-print the output with a number of indentation spaces.
  225
+By default, ``dumpdata`` will output all data on a single line. This isn't
  226
+easy for humans to read, so you can use the ``--indent`` option to
  227
+pretty-print the output with a number of indentation spaces.
230 228
 
231 229
 .. versionadded:: 1.1
232 230
 
@@ -239,22 +237,21 @@ model names.
239 237
 flush
240 238
 -----
241 239
 
242  
-.. django-admin: flush
  240
+.. django-admin:: flush
243 241
 
244 242
 Returns the database to the state it was in immediately after syncdb was
245 243
 executed. This means that all data will be removed from the database, any
246 244
 post-synchronization handlers will be re-executed, and the ``initial_data``
247 245
 fixture will be re-installed.
248 246
 
249  
-.. django-admin-option:: --noinput
250  
-
251  
-    Use the ``--noinput`` option to suppress all user prompting, such as "Are
252  
-    you sure?" confirmation messages. This is useful if ``django-admin.py`` is
253  
-    being executed as an unattended, automated script.
  247
+The :djadminopt:`--noinput` option may be provided to suppress all user
  248
+prompts.
254 249
 
255 250
 inspectdb
256 251
 ---------
257 252
 
  253
+.. django-admin:: inspectdb
  254
+
258 255
 Introspects the database tables in the database pointed-to by the
259 256
 ``DATABASE_NAME`` setting and outputs a Django model module (a ``models.py``
260 257
 file) to standard output.
@@ -296,6 +293,8 @@ only works in PostgreSQL and with certain types of MySQL tables.
296 293
 loaddata <fixture fixture ...>
297 294
 ------------------------------
298 295
 
  296
+.. django-admin:: loaddata
  297
+
299 298
 Searches for and loads the contents of the named fixture into the database.
300 299
 
301 300
 What's a "fixture"?
@@ -382,6 +381,8 @@ installation will be aborted, and any data installed in the call to
382 381
 makemessages
383 382
 ------------
384 383
 
  384
+.. django-admin:: makemessages
  385
+
385 386
 .. versionchanged:: 1.0
386 387
    Before 1.0 this was the ``bin/make-messages.py`` command.
387 388
 
@@ -392,8 +393,7 @@ directory. After making changes to the messages files you need to compile them
392 393
 with ``compilemessages`` for use with the builtin gettext support. See the
393 394
 :ref:`i18n documentation <how-to-create-language-files>` for details.
394 395
 
395  
---all
396  
-~~~~~
  396
+.. django-admin-option:: --all
397 397
 
398 398
 Use the ``--all`` or ``-a`` option to update the message files for all
399 399
 available languages.
@@ -402,8 +402,7 @@ Example usage::
402 402
 
403 403
     django-admin.py makemessages --all
404 404
 
405  
---extension
406  
-~~~~~~~~~~~
  405
+.. django-admin-option:: --extension
407 406
 
408 407
 Use the ``--extension`` or ``-e`` option to specify a list of file extensions
409 408
 to examine (default: ".html").
@@ -416,17 +415,13 @@ Separate multiple extensions with commas or use -e or --extension multiple times
416 415
 
417 416
     django-admin.py makemessages --locale=de --extension=html,txt --extension xml
418 417
 
419  
---locale
420  
-~~~~~~~~
421  
-
422  
-Use the ``--locale`` or ``-l`` option to specify the locale to process.
  418
+Use the :djadminopt:`--locale` option to specify the locale to process.
423 419
 
424 420
 Example usage::
425 421
 
426 422
     django-admin.py makemessages --locale=br_PT
427 423
 
428  
---domain
429  
-~~~~~~~~
  424
+.. django-admin-option:: --domain
430 425
 
431 426
 Use the ``--domain`` or ``-d`` option to change the domain of the messages files.
432 427
 Currently supported:
@@ -434,23 +429,21 @@ Currently supported:
434 429
 	* ``django`` for all ``*.py`` and ``*.html`` files (default)
435 430
 	* ``djangojs`` for ``*.js`` files
436 431
 
437  
-.. _django-admin-reset:
438  
-
439 432
 reset <appname appname ...>
440 433
 ---------------------------
441 434
 
442  
-Executes the equivalent of ``sqlreset`` for the given app name(s).
  435
+.. django-admin:: reset
443 436
 
444  
---noinput
445  
-~~~~~~~~~
  437
+Executes the equivalent of ``sqlreset`` for the given app name(s).
446 438
 
447  
-Use the ``--noinput`` option to suppress all user prompting, such as
448  
-"Are you sure?" confirmation messages. This is useful if ``django-admin.py``
449  
-is being executed as an unattended, automated script.
  439
+The :djadminopt:`--noinput` option may be provided to suppress all user
  440
+prompts.
450 441
 
451 442
 runfcgi [options]
452 443
 -----------------
453 444
 
  445
+.. django-admin:: runfcgi
  446
+
454 447
 Starts a set of FastCGI processes suitable for use with any Web server that
455 448
 supports the FastCGI protocol. See the :ref:`FastCGI deployment documentation
456 449
 <howto-deployment-fastcgi>` for details. Requires the Python FastCGI module from
@@ -458,10 +451,10 @@ supports the FastCGI protocol. See the :ref:`FastCGI deployment documentation
458 451
 
459 452
 .. _flup: http://www.saddi.com/software/flup/
460 453
 
461  
-runserver
462  
----------
  454
+runserver [port or ipaddr:port]
  455
+-------------------------------
463 456
 
464  
-.. django-admin:: runserver [port or ipaddr:port]
  457
+.. django-admin:: runserver
465 458
 
466 459
 Starts a lightweight development Web server on the local machine. By default,
467 460
 the server runs on port 8000 on the IP address 127.0.0.1. You can pass in an
@@ -544,6 +537,8 @@ you want to configure Django to serve static media, read :ref:`howto-static-file
544 537
 shell
545 538
 -----
546 539
 
  540
+.. django-admin:: shell
  541
+
547 542
 Starts the Python interactive interpreter.
548 543
 
549 544
 Django will use IPython_, if it's installed. If you have IPython installed and
@@ -557,11 +552,15 @@ option, like so::
557 552
 sql <appname appname ...>
558 553
 -------------------------
559 554
 
  555
+.. django-admin:: sql
  556
+
560 557
 Prints the CREATE TABLE SQL statements for the given app name(s).
561 558
 
562 559
 sqlall <appname appname ...>
563 560
 ----------------------------
564 561
 
  562
+.. django-admin:: sqlall
  563
+
565 564
 Prints the CREATE TABLE and initial-data SQL statements for the given app name(s).
566 565
 
567 566
 Refer to the description of ``sqlcustom`` for an explanation of how to
@@ -570,11 +569,15 @@ specify initial data.
570 569
 sqlclear <appname appname ...>
571 570
 ------------------------------
572 571
 
  572
+.. django-admin:: sqlclear
  573
+
573 574
 Prints the DROP TABLE SQL statements for the given app name(s).
574 575
 
575 576
 sqlcustom <appname appname ...>
576 577
 -------------------------------
577 578
 
  579
+.. django-admin:: sqlcustom
  580
+
578 581
 Prints the custom SQL statements for the given app name(s).
579 582
 
580 583
 For each model in each specified app, this command looks for the file
@@ -594,21 +597,30 @@ Note that the order in which the SQL files are processed is undefined.
594 597
 sqlflush
595 598
 --------
596 599
 
597  
-Prints the SQL statements that would be executed for the `flush`_ command.
  600
+.. django-admin:: sqlflush
  601
+
  602
+Prints the SQL statements that would be executed for the :djadmin:`flush`
  603
+command.
598 604
 
599 605
 sqlindexes <appname appname ...>
600 606
 --------------------------------
601 607
 
  608
+.. django-admin:: sqlindexes
  609
+
602 610
 Prints the CREATE INDEX SQL statements for the given app name(s).
603 611
 
604 612
 sqlreset <appname appname ...>
605 613
 ------------------------------
606 614
 
  615
+.. django-admin:: sqlreset
  616
+
607 617
 Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).
608 618
 
609 619
 sqlsequencereset <appname appname ...>
610 620
 --------------------------------------
611 621
 
  622
+.. django-admin:: sqlsequencereset
  623
+
612 624
 Prints the SQL statements for resetting sequences for the given app name(s).
613 625
 
614 626
 Sequences are indexes used by some database engines to track the next available
@@ -620,12 +632,16 @@ of sync with its automatically incremented field data.
620 632
 startapp <appname>
621 633
 ------------------
622 634
 
  635
+.. django-admin:: startapp
  636
+
623 637
 Creates a Django app directory structure for the given app name in the current
624 638
 directory.
625 639
 
626 640
 startproject <projectname>
627 641
 --------------------------
628 642
 
  643
+.. django-admin:: startproject
  644
+
629 645
 Creates a Django project directory structure for the given project name in the
630 646
 current directory.
631 647
 
@@ -635,11 +651,11 @@ This command is disabled when the ``--settings`` option to
635 651
 situations, either omit the ``--settings`` option or unset
636 652
 ``DJANGO_SETTINGS_MODULE``.
637 653
 
638  
-.. _django-admin-syncdb:
639  
-
640 654
 syncdb
641 655
 ------
642 656
 
  657
+.. django-admin:: syncdb
  658
+
643 659
 Creates the database tables for all apps in ``INSTALLED_APPS`` whose tables
644 660
 have not already been created.
645 661
 
@@ -669,29 +685,22 @@ with an appropriate extension (e.g. ``json`` or ``xml``). See the
669 685
 documentation for ``loaddata`` for details on the specification of fixture
670 686
 data files.
671 687
 
672  
---noinput
673  
-~~~~~~~~~
  688
+The :djadminopt:`--noinput` option may be provided to suppress all user
  689
+prompts.
674 690
 
675  
-Use the ``--noinput`` option to suppress all user prompting, such as
676  
-"Are you sure?" confirmation messages. This is useful if ``django-admin.py``
677  
-is being executed as an unattended, automated script.
  691
+test <app or test identifier>
  692
+-----------------------------
678 693
 
679  
-test
680  
-----
  694
+.. django-admin:: test
681 695
 
682 696
 Runs tests for all installed models. See :ref:`topics-testing` for more
683 697
 information.
684 698
 
685  
---noinput
686  
-~~~~~~~~~
687  
-
688  
-Use the ``--noinput`` option to suppress all user prompting, such as
689  
-"Are you sure?" confirmation messages. This is useful if ``django-admin.py``
690  
-is being executed as an unattended, automated script.
691  
-
692 699
 testserver <fixture fixture ...>
693 700
 --------------------------------
694 701
 
  702
+.. django-admin:: testserver
  703
+
695 704
 .. versionadded:: 1.0
696 705
 
697 706
 Runs a Django development server (as in ``runserver``) using data from the
@@ -727,8 +736,7 @@ Note that this server does *not* automatically detect changes to your Python
727 736
 source code (as ``runserver`` does). It does, however, detect changes to
728 737
 templates.
729 738
 
730  
---addrport [port number or ipaddr:port]
731  
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  739
+.. django-admin-option:: --addrport [port number or ipaddr:port]
732 740
 
733 741
 Use ``--addrport`` to specify a different port, or IP address and port, from
734 742
 the default of 127.0.0.1:8000. This value follows exactly the same format and
@@ -752,6 +760,8 @@ To run on 1.2.3.4:7000 with a ``test`` fixture::
752 760
 validate
753 761
 --------
754 762
 
  763
+.. django-admin:: validate
  764
+
755 765
 Validates all installed models (according to the ``INSTALLED_APPS`` setting)
756 766
 and prints validation errors to standard output.
757 767
 
@@ -761,8 +771,7 @@ Default options
761 771
 Although some subcommands may allow their own custom options, every subcommand
762 772
 allows for the following options:
763 773
 
764  
---pythonpath
765  
-------------
  774
+.. django-admin-option:: --pythonpath
766 775
 
767 776
 Example usage::
768 777
 
@@ -777,8 +786,7 @@ setting the Python path for you.
777 786
 
778 787
 .. _import search path: http://diveintopython.org/getting_to_know_python/everything_is_an_object.html
779 788
 
780  
---settings
781  
-----------
  789
+.. django-admin-option:: --settings
782 790
 
783 791
 Example usage::
784 792
 
@@ -792,8 +800,7 @@ variable.
792 800
 Note that this option is unnecessary in ``manage.py``, because it uses
793 801
 ``settings.py`` from the current project by default.
794 802
 
795  
---traceback
796  
------------
  803
+.. django-admin-option:: --traceback
797 804
 
798 805
 Example usage::
799 806
 
@@ -803,10 +810,7 @@ By default, ``django-admin.py`` will show a simple error message whenever an
803 810
 error occurs. If you specify ``--traceback``, ``django-admin.py``  will
804 811
 output a full stack trace whenever an exception is raised.
805 812
 
806  
-.. _django-admin-verbosity:
807  
-
808  
---verbosity
809  
------------
  813
+.. django-admin-option:: --verbosity
810 814
 
811 815
 Example usage::
812 816
 
@@ -819,6 +823,23 @@ that ``django-admin.py`` should print to the console.
819 823
     * ``1`` means normal output (default).
820 824
     * ``2`` means verbose output.
821 825
 
  826
+Common options
  827
+==============
  828
+
  829
+The following options are not available on every commands, but they are
  830
+common to a number of commands.
  831
+
  832
+.. django-admin-option:: --locale
  833
+
  834
+Use the ``--locale`` or ``-l`` option to specify the locale to process.
  835
+If not provided all locales are processed.
  836
+
  837
+.. django-admin-option:: --noinput
  838
+
  839
+Use the ``--noinput`` option to suppress all user prompting, such as "Are
  840
+you sure?" confirmation messages. This is useful if ``django-admin.py`` is
  841
+being executed as an unattended, automated script.
  842
+
822 843
 Extra niceties
823 844
 ==============
824 845
 
@@ -844,5 +865,4 @@ distribution. It enables tab-completion of ``django-admin.py`` and
844 865
       with ``sql``.
845 866
 
846 867
 
847  
-
848 868
 See :ref:`howto-custom-management-commands` for how to add customized actions.
7  docs/ref/models/options.txt
@@ -94,9 +94,8 @@ See the docs for :meth:`~django.db.models.QuerySet.latest` for more.
94 94
 .. versionadded:: 1.1
95 95
 
96 96
 Defaults to ``True``, meaning Django will create the appropriate database
97  
-tables in :ref:`django-admin-syncdb` and remove them as part of a :ref:`reset
98  
-<django-admin-reset>` management command. That is, Django *manages* the
99  
-database tables' lifecycles.
  97
+tables in :djadmin:`syncdb` and remove them as part of a :djadmin:`reset`
  98
+management command. That is, Django *manages* the database tables' lifecycles.
100 99
 
101 100
 If ``False``, no database table creation or deletion operations will be
102 101
 performed for this model. This is useful if the model represents an existing
@@ -114,7 +113,7 @@ model handling are exactly the same as normal. This includes
114 113
        unmanaged model, then the intermediate table for the many-to-many join
115 114
        will also not be created. However, a the intermediary table between one
116 115
        managed and one unmanaged model *will* be created.
117  
-       
  116
+
118 117
        If you need to change this default behavior, create the intermediary
119 118
        table as an explicit model (with ``managed`` set as needed) and use the
120 119
        :attr:`ManyToManyField.through` attribute to make the relation use your
7  docs/topics/testing.txt
@@ -980,19 +980,21 @@ subclass::
980 980
 
981 981
         def setUp(self):
982 982
             # Test definitions as before.
  983
+            call_setup_methods()
983 984
 
984 985
         def testFluffyAnimals(self):
985 986
             # A test that uses the fixtures.
  987
+            call_some_test_code()
986 988
 
987 989
 Here's specifically what will happen:
988 990
 
989 991
     * At the start of each test case, before ``setUp()`` is run, Django will
990 992
       flush the database, returning the database to the state it was in
991  
-      directly after ``syncdb`` was called.
  993
+      directly after :djadmin:`syncdb` was called.
992 994
 
993 995
     * Then, all the named fixtures are installed. In this example, Django will
994 996
       install any JSON fixture named ``mammals``, followed by any fixture named
995  
-      ``birds``. See the :djadmin:`loaddata documentation<loaddata>` for more
  997
+      ``birds``. See the :djadmin:`loaddata` documentation for more
996 998
       details on defining and installing fixtures.
997 999
 
998 1000
 This flush/load procedure is repeated for each test in the test case, so you
@@ -1028,6 +1030,7 @@ For example::
1028 1030
 
1029 1031
         def testIndexPageView(self):
1030 1032
             # Here you'd test your view using ``Client``.
  1033
+            call_some_test_code()
1031 1034
 
1032 1035
 This test case will use the contents of ``myapp.test_urls`` as the
1033 1036
 URLconf for the duration of the test case.

0 notes on commit c8514b5

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