summaryrefslogtreecommitdiff
path: root/docs/generic_views.txt
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-07-26 03:48:41 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-07-26 03:48:41 +0000
commit7d574e8f7647a1ac8e2613c4be9c45adf4b5fc0e (patch)
treeab3fb7969fd54c45bc912b7504bec14b8fa7d2ef /docs/generic_views.txt
parent48441f467f32fb36b20b45c88948bd19454df263 (diff)
Removed 'use_numeric_months' parameter in generic date views (from [308]) in favor of something more powerful -- you can now provide month_format and day_format, which are format strings that specify how you expect the month and day to be formatted in the URL.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@312 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/generic_views.txt')
-rw-r--r--docs/generic_views.txt21
1 files changed, 17 insertions, 4 deletions
diff --git a/docs/generic_views.txt b/docs/generic_views.txt
index 4aec295a65..e5cbdf60bf 100644
--- a/docs/generic_views.txt
+++ b/docs/generic_views.txt
@@ -126,10 +126,14 @@ The date-based generic functions are:
``archive_month``
Monthly archive. Requires that ``year`` and ``month`` arguments be given.
- You may pass the additional option ``use_numeric_months`` if you'd like to
- use URLs that use numbers instead of names for months (i.e. ``/2005/01/15/``
- instead of ``/2005/jan/15/``.
-
+ You can pass the additional option ``month_format`` if you'd like to change
+ the way months are specified in the URL.
+
+ ``month_format`` is a format string in the same syntax accepted by Python's
+ ``time.strftime``. (See the `strftime docs`_.) It's set to ``"%b"`` by
+ default, which is a three-letter month abbreviation. To change it to use
+ numbers, use ``"%m"``.
+
Uses the template ``app_label/module_name__archive_month`` by default.
Has the following template context:
@@ -143,6 +147,10 @@ The date-based generic functions are:
Daily archive. Requires that ``year``, ``month``, and ``day`` arguments be
given.
+ As in ``archive_month``, you can pass an optional ``month_format``. You can
+ also pass ``day_format``, which defaults to ``"%d"`` (day of the month as a
+ decimal number, 1-31).
+
Uses the template ``app_label/module_name__archive_day`` by default.
Has the following template context:
@@ -177,6 +185,11 @@ The date-based generic functions are:
You can also pass the ``template_name_field`` argument to indicate that the
the object stores the name of its template in a field on the object itself.
+ As in ``archive_day``, ``object_detail`` takes optional ``month_format``
+ and ``day_format`` parameters.
+
+.. _strftime docs: http://www.python.org/doc/current/lib/module-time.html#l2h-1941
+
Using list/detail generic views
===============================