Fixed #30775 -- Added admonition about missing imports to "Running tests" section in tutorial 5.
This commit is contained in:
parent
6c3dfba892
commit
44077985f5
|
@ -443,8 +443,9 @@ models, not only for your own convenience when dealing with the interactive
|
||||||
prompt, but also because objects' representations are used throughout Django's
|
prompt, but also because objects' representations are used throughout Django's
|
||||||
automatically-generated admin.
|
automatically-generated admin.
|
||||||
|
|
||||||
Note these are normal Python methods. Let's add a custom method, just for
|
.. _tutorial02-import-timezone:
|
||||||
demonstration:
|
|
||||||
|
Let's also add a custom method to this model:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
:caption: polls/models.py
|
:caption: polls/models.py
|
||||||
|
|
|
@ -220,6 +220,13 @@ and you'll see something like::
|
||||||
FAILED (failures=1)
|
FAILED (failures=1)
|
||||||
Destroying test database for alias 'default'...
|
Destroying test database for alias 'default'...
|
||||||
|
|
||||||
|
.. admonition:: Different error?
|
||||||
|
|
||||||
|
If instead you're getting a ``NameError`` here, you may have missed a step
|
||||||
|
in :ref:`Part 2 <tutorial02-import-timezone>` where we added imports of
|
||||||
|
``datetime`` and ``timezone`` to ``polls/models.py``. Copy the imports from
|
||||||
|
that section, and try running your tests again.
|
||||||
|
|
||||||
What happened is this:
|
What happened is this:
|
||||||
|
|
||||||
* ``manage.py test polls`` looked for tests in the ``polls`` application
|
* ``manage.py test polls`` looked for tests in the ``polls`` application
|
||||||
|
|
Loading…
Reference in New Issue