Kaydet (Commit) c8514b57 authored tarafından Russell Keith-Magee's avatar Russell Keith-Magee

Fixed #12204 -- Corrected the use of :djadmin: links in the testing docs, plus…

Fixed #12204 -- Corrected the use of :djadmin: links in the testing docs, 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
üst 632f12fb
This diff is collapsed.
...@@ -94,9 +94,8 @@ See the docs for :meth:`~django.db.models.QuerySet.latest` for more. ...@@ -94,9 +94,8 @@ See the docs for :meth:`~django.db.models.QuerySet.latest` for more.
.. versionadded:: 1.1 .. versionadded:: 1.1
Defaults to ``True``, meaning Django will create the appropriate database Defaults to ``True``, meaning Django will create the appropriate database
tables in :ref:`django-admin-syncdb` and remove them as part of a :ref:`reset tables in :djadmin:`syncdb` and remove them as part of a :djadmin:`reset`
<django-admin-reset>` management command. That is, Django *manages* the management command. That is, Django *manages* the database tables' lifecycles.
database tables' lifecycles.
If ``False``, no database table creation or deletion operations will be If ``False``, no database table creation or deletion operations will be
performed for this model. This is useful if the model represents an existing 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,7 +113,7 @@ model handling are exactly the same as normal. This includes
unmanaged model, then the intermediate table for the many-to-many join unmanaged model, then the intermediate table for the many-to-many join
will also not be created. However, a the intermediary table between one will also not be created. However, a the intermediary table between one
managed and one unmanaged model *will* be created. managed and one unmanaged model *will* be created.
If you need to change this default behavior, create the intermediary If you need to change this default behavior, create the intermediary
table as an explicit model (with ``managed`` set as needed) and use the table as an explicit model (with ``managed`` set as needed) and use the
:attr:`ManyToManyField.through` attribute to make the relation use your :attr:`ManyToManyField.through` attribute to make the relation use your
......
...@@ -980,19 +980,21 @@ subclass:: ...@@ -980,19 +980,21 @@ subclass::
def setUp(self): def setUp(self):
# Test definitions as before. # Test definitions as before.
call_setup_methods()
def testFluffyAnimals(self): def testFluffyAnimals(self):
# A test that uses the fixtures. # A test that uses the fixtures.
call_some_test_code()
Here's specifically what will happen: Here's specifically what will happen:
* At the start of each test case, before ``setUp()`` is run, Django will * At the start of each test case, before ``setUp()`` is run, Django will
flush the database, returning the database to the state it was in flush the database, returning the database to the state it was in
directly after ``syncdb`` was called. directly after :djadmin:`syncdb` was called.
* Then, all the named fixtures are installed. In this example, Django will * Then, all the named fixtures are installed. In this example, Django will
install any JSON fixture named ``mammals``, followed by any fixture named install any JSON fixture named ``mammals``, followed by any fixture named
``birds``. See the :djadmin:`loaddata documentation<loaddata>` for more ``birds``. See the :djadmin:`loaddata` documentation for more
details on defining and installing fixtures. details on defining and installing fixtures.
This flush/load procedure is repeated for each test in the test case, so you This flush/load procedure is repeated for each test in the test case, so you
...@@ -1028,6 +1030,7 @@ For example:: ...@@ -1028,6 +1030,7 @@ For example::
def testIndexPageView(self): def testIndexPageView(self):
# Here you'd test your view using ``Client``. # Here you'd test your view using ``Client``.
call_some_test_code()
This test case will use the contents of ``myapp.test_urls`` as the This test case will use the contents of ``myapp.test_urls`` as the
URLconf for the duration of the test case. URLconf for the duration of the test case.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment