mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
newforms-admin: Merged from trunk up to [7729].
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -702,13 +702,8 @@ Django tarball. It's our policy to make sure all tests pass at all times.
|
||||
The tests cover:
|
||||
|
||||
* Models and the database API (``tests/modeltests/``).
|
||||
* The cache system (``tests/regressiontests/cache.py``).
|
||||
* The ``django.utils.dateformat`` module (``tests/regressiontests/dateformat/``).
|
||||
* Database typecasts (``tests/regressiontests/db_typecasts/``).
|
||||
* The template system (``tests/regressiontests/templates/`` and
|
||||
``tests/regressiontests/defaultfilters/``).
|
||||
* ``QueryDict`` objects (``tests/regressiontests/httpwrappers/``).
|
||||
* Markup template tags (``tests/regressiontests/markup/``).
|
||||
* Everything else in core Django code (``tests/regressiontests``)
|
||||
* Contrib apps (``django/contrib/<contribapp>/tests``, see below)
|
||||
|
||||
We appreciate any and all contributions to the test suite!
|
||||
|
||||
@@ -744,6 +739,26 @@ If you're using another backend:
|
||||
deleted when the tests are finished. This means your user account needs
|
||||
permission to execute ``CREATE DATABASE``.
|
||||
|
||||
If you want to run the full suite of tests, there are a number of dependencies that
|
||||
you should install:
|
||||
|
||||
* PyYAML_
|
||||
* Markdown_
|
||||
* Textile_
|
||||
* Docutils_
|
||||
* setuptools_
|
||||
|
||||
Of these dependencies, setuptools_ is the only dependency that is required - if
|
||||
setuptools_ is not installed, you will get import errors when running one of
|
||||
the template tests. The tests using the other libraries will be skipped if the
|
||||
dependency can't be found.
|
||||
|
||||
.. _PyYAML: http://pyyaml.org/wiki/PyYAML
|
||||
.. _Markdown: http://pypi.python.org/pypi/Markdown/1.7
|
||||
.. _Textile: http://pypi.python.org/pypi/textile
|
||||
.. _docutils: http://pypi.python.org/pypi/docutils/0.4
|
||||
.. _setuptools: http://pypi.python.org/pypi/setuptools/
|
||||
|
||||
To run a subset of the unit tests, append the names of the test modules to the
|
||||
``runtests.py`` command line. See the list of directories in
|
||||
``tests/modeltests`` and ``tests/regressiontests`` for module names.
|
||||
@@ -755,6 +770,22 @@ for generic relations and internationalization, type::
|
||||
PYTHONPATH=..
|
||||
./runtests.py --settings=settings generic_relations i18n
|
||||
|
||||
Contrib apps
|
||||
------------
|
||||
|
||||
Tests for apps in ``django/contrib/`` go in their respective directories,
|
||||
in a ``tests.py`` file. (You can split the tests over multiple modules
|
||||
by using a ``tests`` folder in the normal Python way).
|
||||
|
||||
For the tests to be found, a ``models.py`` file must exist (it doesn't
|
||||
have to have anything in it). If you have URLs that need to be
|
||||
mapped, you must add them in ``tests/urls.py``.
|
||||
|
||||
To run tests for just one contrib app (e.g. ``markup``), use the same
|
||||
method as above::
|
||||
|
||||
./runtests.py --settings=settings markup
|
||||
|
||||
Requesting features
|
||||
===================
|
||||
|
||||
|
||||
@@ -1382,7 +1382,7 @@ and then converted into a query using the ``query`` attribute::
|
||||
|
||||
This queryset will be evaluated as subselect statement::
|
||||
|
||||
SELET ... WHERE blog.id IN (SELECT id FROM ... WHERE NAME LIKE '%Cheddar%')
|
||||
SELECT ... WHERE blog.id IN (SELECT id FROM ... WHERE NAME LIKE '%Cheddar%')
|
||||
|
||||
startswith
|
||||
~~~~~~~~~~
|
||||
|
||||
@@ -648,8 +648,8 @@ Django will automatically add this field::
|
||||
Thus, you don't need to set ``primary_key=True`` on any of your fields
|
||||
unless you want to override the default primary-key behavior.
|
||||
|
||||
``primary_key=True`` implies ``blank=False``, ``null=False`` and
|
||||
``unique=True``. Only one primary key is allowed on an object.
|
||||
``primary_key=True`` implies ``null=False`` and ``unique=True``. Only
|
||||
one primary key is allowed on an object.
|
||||
|
||||
``unique``
|
||||
~~~~~~~~~~
|
||||
|
||||
@@ -182,6 +182,13 @@ supplied, ``save()`` will update that instance. If it's not supplied,
|
||||
# Create a form to edit an existing Article.
|
||||
>>> a = Article.objects.get(pk=1)
|
||||
>>> f = ArticleForm(instance=a)
|
||||
>>> f.save()
|
||||
|
||||
# Create a form to edit an existing Article, but use
|
||||
# POST data to populate the form.
|
||||
>>> a = Article.objects.get(pk=1)
|
||||
>>> f = ArticleForm(request.POST, instance=a)
|
||||
>>> f.save()
|
||||
|
||||
Note that ``save()`` will raise a ``ValueError`` if the data in the form
|
||||
doesn't validate -- i.e., ``if form.errors``.
|
||||
|
||||
Reference in New Issue
Block a user