diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2006-11-10 15:42:40 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2006-11-10 15:42:40 +0000 |
| commit | 889bf502818df7cbf8332a330703ff97dce01f2d (patch) | |
| tree | 0480275012190083544debebb212499b7788b226 /docs | |
| parent | 16e873e32b73c286ebdd4fd0050dc9229f2809a8 (diff) | |
[generic-auth] Merged to [4062]
git-svn-id: http://code.djangoproject.com/svn/django/branches/generic-auth@4063 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/forms.txt | 9 | ||||
| -rw-r--r-- | docs/settings.txt | 18 | ||||
| -rw-r--r-- | docs/syndication_feeds.txt | 18 | ||||
| -rw-r--r-- | docs/templates.txt | 33 | ||||
| -rw-r--r-- | docs/templates_python.txt | 2 | ||||
| -rw-r--r-- | docs/testing.txt | 2 |
6 files changed, 66 insertions, 16 deletions
diff --git a/docs/forms.txt b/docs/forms.txt index 4a4ba37289..ff192a4717 100644 --- a/docs/forms.txt +++ b/docs/forms.txt @@ -610,6 +610,15 @@ fails. If no message is passed in, a default message is used. string "123" is less than the string "2", for example. If you don't want string comparison here, you will need to write your own validator. +``NumberIsInRange`` + Takes two boundary numbers, ``lower`` and ``upper``, and checks that the + field is greater than ``lower`` (if given) and less than ``upper`` (if + given). + + Both checks are inclusive. That is, ``NumberIsInRange(10, 20)`` will allow + values of both 10 and 20. This validator only checks numeric values + (e.g., float and integer values). + ``IsAPowerOf`` Takes an integer argument and when called as a validator, checks that the field being validated is a power of the integer. diff --git a/docs/settings.txt b/docs/settings.txt index 272b20f753..ff1e2eeca2 100644 --- a/docs/settings.txt +++ b/docs/settings.txt @@ -265,6 +265,14 @@ Default: ``''`` (Empty string) The name of the database to use. For SQLite, it's the full path to the database file. +DATABASE_OPTIONS +---------------- + +Default: ``{}`` (Empty dictionary) + +Extra parameters to use when connecting to the database. Consult backend +module's document for available keywords. + DATABASE_PASSWORD ----------------- @@ -814,6 +822,16 @@ manual configuration option (see below), Django will *not* touch the ``TZ`` environment variable, and it'll be up to you to ensure your processes are running in the correct environment. +URL_VALIDATOR_USER_AGENT +------------------------ + +Default: ``Django/<version> (http://www.djangoproject.com/)`` + +The string to use as the ``User-Agent`` header when checking to see if URLs +exist (see the ``verify_exists`` option on URLField_). + +.. URLField: ../model_api/#urlfield + USE_ETAGS --------- diff --git a/docs/syndication_feeds.txt b/docs/syndication_feeds.txt index 225b67eb02..59a9022d9b 100644 --- a/docs/syndication_feeds.txt +++ b/docs/syndication_feeds.txt @@ -95,7 +95,7 @@ latest five news items:: from django.contrib.syndication.feeds import Feed from chicagocrime.models import NewsItem - class SiteNewsFeed(Feed): + class LatestEntries(Feed): title = "Chicagocrime.org site news" link = "/sitenews/" description = "Updates on changes and additions to chicagocrime.org." @@ -120,14 +120,14 @@ One thing's left to do. In an RSS feed, each ``<item>`` has a ``<title>``, put into those elements. * To specify the contents of ``<title>`` and ``<description>``, create - `Django templates`_ called ``feeds/sitenews_title.html`` and - ``feeds/sitenews_description.html``, where ``sitenews`` is the ``slug`` + `Django templates`_ called ``feeds/latest_title.html`` and + ``feeds/latest_description.html``, where ``latest`` is the ``slug`` specified in the URLconf for the given feed. Note the ``.html`` extension is required. The RSS system renders that template for each item, passing it two template context variables: * ``{{ obj }}`` -- The current object (one of whichever objects you - returned in ``items()``). + returned in ``items()``). * ``{{ site }}`` -- A ``django.models.core.sites.Site`` object representing the current site. This is useful for ``{{ site.domain }}`` or ``{{ site.name }}``. @@ -145,6 +145,16 @@ put into those elements. Both ``get_absolute_url()`` and ``item_link()`` should return the item's URL as a normal Python string. + * For the LatestEntries example above, we could have very simple feed templates: + + * latest_title.html:: + + {{ obj.title }} + + * latest_description.html:: + + {{ obj.description }} + .. _chicagocrime.org: http://www.chicagocrime.org/ .. _object-relational mapper: http://www.djangoproject.com/documentation/db_api/ .. _Django templates: http://www.djangoproject.com/documentation/templates/ diff --git a/docs/templates.txt b/docs/templates.txt index 92d4b53660..b4cc47b9f3 100644 --- a/docs/templates.txt +++ b/docs/templates.txt @@ -473,7 +473,7 @@ block are output:: In the above, if ``athlete_list`` is not empty, the number of athletes will be displayed by the ``{{ athlete_list|length }}`` variable. -As you can see, the ``if`` tag can take an option ``{% else %}`` clause that +As you can see, the ``if`` tag can take an optional ``{% else %}`` clause that will be displayed if the test fails. ``if`` tags may use ``and``, ``or`` or ``not`` to test a number of variables or @@ -525,16 +525,29 @@ ifchanged Check if a value has changed from the last iteration of a loop. -The ``ifchanged`` block tag is used within a loop. It checks its own rendered -contents against its previous state and only displays its content if the value -has changed:: +The 'ifchanged' block tag is used within a loop. It has two possible uses. - <h1>Archive for {{ year }}</h1> +1. Checks its own rendered contents against its previous state and only + displays the content if it has changed. For example, this displays a list of + days, only displaying the month if it changes:: - {% for day in days %} - {% ifchanged %}<h3>{{ day|date:"F" }}</h3>{% endifchanged %} - <a href="{{ day|date:"M/d"|lower }}/">{{ day|date:"j" }}</a> - {% endfor %} + <h1>Archive for {{ year }}</h1> + + {% for date in days %} + {% ifchanged %}<h3>{{ date|date:"F" }}</h3>{% endifchanged %} + <a href="{{ date|date:"M/d"|lower }}/">{{ date|date:"j" }}</a> + {% endfor %} + +2. **New in Django development version.** If given a variable, check whether that + variable has changed. For example, the following shows the date every time it + changes, but only shows the hour if both the hour and the date has changed:: + + {% for date in days %} + {% ifchanged date.date %} {{ date.date }} {% endifchanged %} + {% ifchanged date.hour date.date %} + {{ date.hour }} + {% endifchanged %} + {% endfor %} ifequal ~~~~~~~ @@ -558,7 +571,7 @@ The arguments can be hard-coded strings, so the following is valid:: It is only possible to compare an argument to template variables or strings. You cannot check for equality with Python objects such as ``True`` or ``False``. If you need to test if something is true or false, use the ``if`` -and ``ifnot`` tags instead. +tag instead. ifnotequal ~~~~~~~~~~ diff --git a/docs/templates_python.txt b/docs/templates_python.txt index ae2582d7b8..7aeed935b9 100644 --- a/docs/templates_python.txt +++ b/docs/templates_python.txt @@ -321,7 +321,7 @@ Note:: def some_view(request): # ... - return render_to_response('my_template'html', + return render_to_response('my_template.html', my_data_dictionary, context_instance=RequestContext(request)) diff --git a/docs/testing.txt b/docs/testing.txt index 19eef9f071..68eff07788 100644 --- a/docs/testing.txt +++ b/docs/testing.txt @@ -10,7 +10,7 @@ used to validate that code behaves as expected. When refactoring or modifying code, tests serve as a guide to ensure that behavior hasn't changed unexpectedly as a result of the refactor. -Testing an web application is a complex task, as there are many +Testing a web application is a complex task, as there are many components of a web application that must be validated and tested. To help you test your application, Django provides a test execution framework, and range of utilities that can be used to stimulate and |
