Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added example of strftime formatting to docs/model-api.txt FileField …

…docs. Thanks for the suggestion, Bradley Whittington

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3538 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 284bf1cf7d099fb75afa56a7d7a8952e093d612f 1 parent 19c48c9
@adrianholovaty adrianholovaty authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 docs/model-api.txt
View
7 docs/model-api.txt
@@ -223,6 +223,13 @@ steps:
the absolute URL to your image in a template with ``{{
object.get_mug_shot_url }}``.
+For example, say your ``MEDIA_ROOT`` is set to ``'/home/media'``, and
+``upload_to`` is set to ``'photos/%Y/%m/%d'``. The ``'%Y/%m/%d'`` part of
+``upload_to`` is strftime formatting; ``'%Y'`` is the four-digit year,
+``'%m'`` is the two-digit month and ``'%d'`` is the two-digit day. If you
+upload a file on Jan. 15, 2007, it will be saved in the directory
+``/home/media/photos/2007/01/15``.
+
.. _`strftime formatting`: http://docs.python.org/lib/module-time.html#l2h-1941
``FilePathField``
Please sign in to comment.
Something went wrong with that request. Please try again.