magic-removal: Merged to [2323]

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2324 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-02-17 18:06:45 +00:00
parent a4c6730aa1
commit d1a91e311a
4 changed files with 19 additions and 6 deletions

View File

@ -467,7 +467,7 @@ class SelectField(FormField):
selected_html = ''
if str(value) == str_data:
selected_html = ' selected="selected"'
output.append(' <option value="%s"%s>%s</option>' % (escape(value), selected_html, display_name))
output.append(' <option value="%s"%s>%s</option>' % (escape(value), selected_html, escape(display_name)))
output.append(' </select>')
return '\n'.join(output)

View File

@ -86,7 +86,11 @@ def archive_month(request, year, month, queryset, date_field,
Templates: ``<app_label>/<model_name>_archive_month``
Context:
month:
this month
(date) this month
next_month:
(date) the first day of the next month, or None if the next month is in the future
previous_month:
(date) the first day of the previous month
object_list:
list of objects published in the given month
"""
@ -116,6 +120,8 @@ def archive_month(request, year, month, queryset, date_field,
c = RequestContext(request, {
'object_list': object_list,
'month': date,
'next_month': (last_day < datetime.date.today()) and (last_day + datetime.timedelta(days=1)) or None,
'previous_month': first_day - datetime.timedelta(days=1),
}, context_processors)
for key, value in extra_context.items():
if callable(value):

View File

@ -56,13 +56,13 @@ DEFAULT_DIRECTORY_INDEX_TEMPLATE = """
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
<meta name="robots" content="NONE,NOARCHIVE" />
<title>Index of {{ directory }}</title>
<title>Index of {{ directory|escape }}</title>
</head>
<body>
<h1>Index of {{ directory }}</h1>
<h1>Index of {{ directory|escape }}</h1>
<ul>
{% for f in file_list %}
<li><a href="{{ f }}">{{ f }}</a></li>
<li><a href="{{ f|urlencode }}">{{ f|escape }}</a></li>
{% endfor %}
</ul>
</body>

View File

@ -190,7 +190,14 @@ The date-based generic functions are:
Has the following template context:
``month``
The given month (a datetime.datetime object)
The given month (a datetime.date object)
``next_month``
**New in Django development version.** The first day of the next
month, or None if the next month is in the future (a datetime.date
object)
``previous_month``
**New in Django development version.** The first day of the
previous month (a datetime.date object)
``object_list``
List of objects published in the given month