From 9222091de8fa2fcb4fedd74ac99b65c88d295135 Mon Sep 17 00:00:00 2001 From: Honza Král Date: Fri, 11 Sep 2009 21:23:55 +0000 Subject: [soc2009/model-validation] Merged to trunk at r11499 git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@11513 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/forms/widgets.txt | 10 ++++++++++ docs/ref/request-response.txt | 11 +---------- docs/topics/auth.txt | 11 +++++++---- docs/topics/generic-views.txt | 20 ++++++++++---------- 4 files changed, 28 insertions(+), 24 deletions(-) (limited to 'docs') diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index e2ba0d7889..1fc2bfa85d 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -159,6 +159,16 @@ commonly used groups of widgets: .. versionchanged:: 1.1 The ``date_format`` and ``time_format`` arguments were not supported in Django 1.0. +.. class:: SelectDateWidget + + Wrapper around three select widgets: one each for month, day, and year. + Note that this widget lives in a separate file from the standard widgets. + + .. code-block:: python + + from django.forms.extras.widgets import SelectDateWidget + + date = forms.DateField(widget=SelectDateWidget()) Specifying widgets ------------------ diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 8701c76235..9df156a6f2 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -232,16 +232,7 @@ Methods Returns ``True`` if the request was made via an ``XMLHttpRequest``, by checking the ``HTTP_X_REQUESTED_WITH`` header for the string - ``'XMLHttpRequest'``. The following major JavaScript libraries all send this - header: - - * jQuery - * Dojo - * MochiKit - * MooTools - * Prototype - * YUI - + ``'XMLHttpRequest'``. Most modern JavaScript libraries send this header. If you write your own XMLHttpRequest call (on the browser side), you'll have to set this header manually if you want ``is_ajax()`` to work. diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt index 7858e44962..615382bb07 100644 --- a/docs/topics/auth.txt +++ b/docs/topics/auth.txt @@ -29,13 +29,16 @@ Installation Authentication support is bundled as a Django application in ``django.contrib.auth``. To install it, do the following: - 1. Put ``'django.contrib.auth'`` in your :setting:`INSTALLED_APPS` setting. + 1. Put ``'django.contrib.auth'`` and ``'django.contrib.contenttypes'`` in + your :setting:`INSTALLED_APPS` setting. + (The :class:`~django.contrib.auth.models.Permisson` model in + :mod:`django.contrib.auth` depends on :mod:`django.contrib.contenttypes`.) 2. Run the command ``manage.py syncdb``. Note that the default :file:`settings.py` file created by -:djadmin:`django-admin.py startproject` includes ``'django.contrib.auth'`` in -:setting:`INSTALLED_APPS` for convenience. If your :setting:`INSTALLED_APPS` -already contains ``'django.contrib.auth'``, feel free to run +:djadmin:`django-admin.py startproject` includes ``'django.contrib.auth'`` and +``'django.contrib.contenttypes'`` in :setting:`INSTALLED_APPS` for convenience. +If your :setting:`INSTALLED_APPS` already contains these apps, feel free to run :djadmin:`manage.py syncdb` again; you can run that command as many times as you'd like, and each time it'll only install what's needed. diff --git a/docs/topics/generic-views.txt b/docs/topics/generic-views.txt index c7d751a86b..e4094ac000 100644 --- a/docs/topics/generic-views.txt +++ b/docs/topics/generic-views.txt @@ -150,7 +150,7 @@ be using these models:: publisher = models.ForeignKey(Publisher) publication_date = models.DateField() -To build a list page of all books, we'd use a URLconf along these lines:: +To build a list page of all publishers, we'd use a URLconf along these lines:: from django.conf.urls.defaults import * from django.views.generic import list_detail @@ -176,7 +176,7 @@ version of the model's name. .. highlightlang:: html+django This template will be rendered against a context containing a variable called -``object_list`` that contains all the book objects. A very simple template +``object_list`` that contains all the publisher objects. A very simple template might look like the following:: {% extends "base.html" %} @@ -217,7 +217,7 @@ Making "friendly" template contexts You might have noticed that our sample publisher list template stores all the books in a variable named ``object_list``. While this works just fine, it isn't all that "friendly" to template authors: they have to "just know" that they're -dealing with books here. A better name for that variable would be +dealing with publishers here. A better name for that variable would be ``publisher_list``; that variable's content is pretty obvious. We can change the name of that variable easily with the ``template_object_name`` @@ -241,14 +241,14 @@ Adding extra context -------------------- Often you simply need to present some extra information beyond that provided by -the generic view. For example, think of showing a list of all the other -publishers on each publisher detail page. The ``object_detail`` generic view -provides the publisher to the context, but it seems there's no way to get a list -of *all* publishers in that template. +the generic view. For example, think of showing a list of all the books on each +publisher detail page. The ``object_detail`` generic view provides the +publisher to the context, but it seems there's no way to get additional +information in that template. But there is: all generic views take an extra optional parameter, ``extra_context``. This is a dictionary of extra objects that will be added to -the template's context. So, to provide the list of all publishers on the detail +the template's context. So, to provide the list of all books on the detail detail view, we'd use an info dict like this: .. parsed-literal:: @@ -268,9 +268,9 @@ generic view. It's very handy. However, there's actually a subtle bug here -- can you spot it? The problem has to do with when the queries in ``extra_context`` are evaluated. -Because this example puts ``Publisher.objects.all()`` in the URLconf, it will +Because this example puts ``Book.objects.all()`` in the URLconf, it will be evaluated only once (when the URLconf is first loaded). Once you add or -remove publishers, you'll notice that the generic view doesn't reflect those +remove books, you'll notice that the generic view doesn't reflect those changes until you reload the Web server (see :ref:`caching-and-querysets` for more information about when QuerySets are cached and evaluated). -- cgit v1.3