diff --git a/django/core/rss.py b/django/core/rss.py
index a381a9cd78..cd2bcf4ad1 100644
--- a/django/core/rss.py
+++ b/django/core/rss.py
@@ -7,7 +7,7 @@ from django.conf.settings import LANGUAGE_CODE, SETTINGS_MODULE
class FeedConfiguration:
def __init__(self, slug, title_cb, link_cb, description_cb, get_list_func_cb, get_list_kwargs,
- param_func=None, param_kwargs_cb=None, get_list_kwargs_cb=None,
+ param_func=None, param_kwargs_cb=None, get_list_kwargs_cb=None, get_pubdate_cb=None,
enc_url=None, enc_length=None, enc_mime_type=None):
"""
slug -- Normal Python string. Used to register the feed.
@@ -28,6 +28,9 @@ class FeedConfiguration:
get_list_kwargs_cb -- Function that takes the param and returns a
dictionary to use in addition to get_list_kwargs (if applicable).
+
+ get_pubdate_cb -- Function that takes the object and returns a datetime
+ to use as the publication date in the feed.
The three enc_* parameters are strings representing methods or
attributes to call on a particular item to get its enclosure
@@ -41,6 +44,7 @@ class FeedConfiguration:
self.get_list_kwargs = get_list_kwargs
self.param_func, self.param_kwargs_cb = param_func, param_kwargs_cb
self.get_list_kwargs_cb = get_list_kwargs_cb
+ self.get_pubdate_cb = get_pubdate_cb
assert (None == enc_url == enc_length == enc_mime_type) or (enc_url is not None and enc_length is not None and enc_mime_type is not None)
self.enc_url = enc_url
self.enc_length = enc_length
@@ -95,6 +99,7 @@ class FeedConfiguration:
description = description_template.render(Context({'obj': obj, 'site': current_site})).decode('utf-8'),
unique_id=link,
enclosure=enc,
+ pubdate = self.get_pubdate_cb and self.get_pubdate_cb(obj) or None,
)
return f
diff --git a/docs/db-api.txt b/docs/db-api.txt
index 4c49a2760f..e0885da8f0 100644
--- a/docs/db-api.txt
+++ b/docs/db-api.txt
@@ -524,7 +524,7 @@ model with an ``ImageField`` will also get this method.
get_FOO_url()
-------------
-For every ``FileField``, the object will have a ``get_FOO_filename()`` method,
+For every ``FileField``, the object will have a ``get_FOO_url()`` method,
where ``FOO`` is the name of the field. This returns the full URL to the file,
according to your ``MEDIA_URL`` setting. If the value is blank, this method
returns an empty string.
diff --git a/docs/model-api.txt b/docs/model-api.txt
index 918f4eb5db..4af193ca48 100644
--- a/docs/model-api.txt
+++ b/docs/model-api.txt
@@ -248,7 +248,28 @@ Here are all available field types:
uploaded files don't fill up the given directory).
The admin represents this as an ```` (a file-upload widget).
+
+ Using a `FieldField` or an ``ImageField`` (see below) in a model takes a few
+ steps:
+
+ 1. In your settings file, you'll need to define ``MEDIA_ROOT``as the
+ full path to a directory where you'd like Django to store uploaded
+ files. (For performance, these files are not stored in the database.)
+ Define ``MEDIA_URL`` as the base public URL of that directory. Make
+ sure that this directory is writable by the Web server's user
+ account.
+
+ 2. Add the ``FileField`` or ``ImageField`` to your model, making sure
+ to define the ``upload_to`` option to tell Django to which
+ subdirectory of ``MEDIA_ROOT`` it should upload files.
+ 3. All that will be stored in your database is a path to the file
+ (relative to ``MEDIA_ROOT``). You'll must likely want to use the
+ convenience ``get__url`` function provided by Django. For
+ example, if your ``ImageField`` is called ``mug_shot``, you can get
+ the absolute URL to your image in a template with ``{{
+ object.get_mug_shot_url }}``.
+
.. _`strftime formatting`: http://docs.python.org/lib/module-time.html#l2h-1941
``FloatField``
@@ -281,7 +302,7 @@ Here are all available field types:
width of the image each time a model instance is saved.
Requires the `Python Imaging Library`_.
-
+
.. _Python Imaging Library: http://www.pythonware.com/products/pil/
``IntegerField``
diff --git a/docs/tutorial01.txt b/docs/tutorial01.txt
index 629a2ab017..d69afa7392 100644
--- a/docs/tutorial01.txt
+++ b/docs/tutorial01.txt
@@ -385,23 +385,23 @@ Let's jump back into the Python interactive shell::
# Django provides a rich database lookup API that's entirely driven by
# keyword arguments.
>>> polls.get_object(id__exact=1)
- What's up
+ What's up?
>>> polls.get_object(question__startswith='What')
- What's up
+ What's up?
>>> polls.get_object(pub_date__year=2005)
- What's up
+ What's up?
>>> polls.get_object(id__exact=2)
Traceback (most recent call last):
...
PollDoesNotExist: Poll does not exist for {'id__exact': 2}
>>> polls.get_list(question__startswith='What')
- [What's up]
+ [What's up?]
# Lookup by a primary key is the most common case, so Django provides a
# shortcut for primary-key exact lookups.
# The following is identical to polls.get_object(id__exact=1).
>>> polls.get_object(pk=1)
- What's up
+ What's up?
# Make sure our custom method worked.
>>> p = polls.get_object(pk=1)
@@ -419,7 +419,7 @@ Let's jump back into the Python interactive shell::
# Choice objects have API access to their related Poll objects.
>>> c.get_poll()
- What's up
+ What's up?
# And vice versa: Poll objects get access to Choice objects.
>>> p.get_choice_list()
diff --git a/docs/tutorial03.txt b/docs/tutorial03.txt
index 2bbd8d7782..84fb64abfe 100644
--- a/docs/tutorial03.txt
+++ b/docs/tutorial03.txt
@@ -91,8 +91,8 @@ Finally, it calls that ``detail()`` function like so::
detail(request=, poll_id=23)
The ``poll_id=23`` part comes from ``(?P\d+)``. Using
-``(?pattern)`` "captures" the text matched by ``pattern`` and sends it as
-a keyword argument to the view function.
+``(?Ppattern)`` "captures" the text matched by ``pattern`` and sends it
+as a keyword argument to the view function.
Because the URL patterns are regular expressions, there really is no limit on
what you can do with them. And there's no need to add URL cruft such as