From 478ebadec7fa9045b2f1ea2027919339572007f2 Mon Sep 17 00:00:00 2001 From: Jason Pellerin Date: Mon, 4 Dec 2006 20:52:14 +0000 Subject: [multi-db] Merged trunk to [4050]. Some tests still failing. git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@4157 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/forms.txt | 9 +++++++++ docs/settings.txt | 18 ++++++++++++++++++ docs/syndication_feeds.txt | 18 ++++++++++++++---- docs/templates.txt | 33 +++++++++++++++++++++++---------- 4 files changed, 64 insertions(+), 14 deletions(-) (limited to 'docs') diff --git a/docs/forms.txt b/docs/forms.txt index 4a4ba37289..1c683c44f7 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 number, ``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 fields + (i.e. floats and integer fields). + ``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 2253faf5ff..61a8f7622a 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 ----------------- @@ -821,6 +829,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/ (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 ```` has a ````, 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..cb06fa27d9 100644 --- a/docs/templates.txt +++ b/docs/templates.txt @@ -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:: - - <h1>Archive for {{ year }}</h1> - - {% for day in days %} - {% ifchanged %}<h3>{{ day|date:"F" }}</h3>{% endifchanged %} - <a href="{{ day|date:"M/d"|lower }}/">{{ day|date:"j" }}</a> - {% endfor %} +The 'ifchanged' block tag is used within a loop. It has two possible uses. + +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:: + + <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. If given a variable, check if 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 ~~~~~~~ -- cgit v1.3