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
This commit is contained in:
Adrian Holovaty 2005-07-26 03:48:41 +00:00
parent 48441f467f
commit 7d574e8f76
2 changed files with 47 additions and 52 deletions

View file

@ -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
===============================