Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
bebb449a
Kaydet (Commit)
bebb449a
authored
Eyl 22, 2013
tarafından
Ramiro Morales
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added docs for changes in commit
dd3a8838
.
Refs #20693.
üst
5a64f9bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
5 deletions
+30
-5
builtins.txt
docs/ref/templates/builtins.txt
+24
-5
1.7.txt
docs/releases/1.7.txt
+6
-0
No files found.
docs/ref/templates/builtins.txt
Dosyayı görüntüle @
bebb449a
...
@@ -1255,6 +1255,8 @@ with some differences.
...
@@ -1255,6 +1255,8 @@ with some differences.
These format characters are not used in Django outside of templates. They
These format characters are not used in Django outside of templates. They
were designed to be compatible with PHP to ease transitioning for designers.
were designed to be compatible with PHP to ease transitioning for designers.
.. _date-and-time-formatting-specifiers:
Available format strings:
Available format strings:
================ ======================================== =====================
================ ======================================== =====================
...
@@ -1338,7 +1340,7 @@ For example::
...
@@ -1338,7 +1340,7 @@ For example::
{{ value|date:"D d M Y" }}
{{ value|date:"D d M Y" }}
If ``value`` is a
``datetime`
` object (e.g., the result of
If ``value`` is a
:py:class:`~datetime.datetime
` object (e.g., the result of
``datetime.datetime.now()``), the output will be the string
``datetime.datetime.now()``), the output will be the string
``'Wed 09 Jan 2008'``.
``'Wed 09 Jan 2008'``.
...
@@ -1363,6 +1365,11 @@ When used without a format string::
...
@@ -1363,6 +1365,11 @@ When used without a format string::
...the formatting string defined in the :setting:`DATE_FORMAT` setting will be
...the formatting string defined in the :setting:`DATE_FORMAT` setting will be
used, without applying any localization.
used, without applying any localization.
You can combine ``date`` with the :tfilter:`time` filter to render a full
representation of a ``datetime`` value. E.g.::
{{ value|date:"D d M Y" }} {{ value|time:"H:i" }}
.. templatefilter:: default
.. templatefilter:: default
default
default
...
@@ -2023,10 +2030,6 @@ Given format can be the predefined one :setting:`TIME_FORMAT`, or a custom
...
@@ -2023,10 +2030,6 @@ Given format can be the predefined one :setting:`TIME_FORMAT`, or a custom
format, same as the :tfilter:`date` filter. Note that the predefined format
format, same as the :tfilter:`date` filter. Note that the predefined format
is locale-dependant.
is locale-dependant.
The time filter will only accept parameters in the format string that relate
to the time of day, not the date (for obvious reasons). If you need to
format a date, use the :tfilter:`date` filter.
For example::
For example::
{{ value|time:"H:i" }}
{{ value|time:"H:i" }}
...
@@ -2044,6 +2047,17 @@ for example, ``"de"``, then for::
...
@@ -2044,6 +2047,17 @@ for example, ``"de"``, then for::
the output will be the string ``"01:23:00"`` (The ``"TIME_FORMAT"`` format
the output will be the string ``"01:23:00"`` (The ``"TIME_FORMAT"`` format
specifier for the ``de`` locale as shipped with Django is ``"H:i:s"``).
specifier for the ``de`` locale as shipped with Django is ``"H:i:s"``).
The ``time`` filter will only accept parameters in the format string that
relate to the time of day, not the date (for obvious reasons). If you need to
format a ``date`` value, use the :tfilter:`date` filter instead (or along
``time`` if you need to render a full :py:class:`~datetime.datetime` value).
There is one exception the above rule: When passed a ``datetime`` value with
attached timezone information (a :ref:`time-zone-aware
<naive_vs_aware_datetimes>` ``datetime`` instance) the ``time`` filter will
accept the timezone-related :ref:`format specifiers
<date-and-time-formatting-specifiers>` ``'e'``, ``'O'`` , ``'T'`` and ``'Z'``.
When used without a format string::
When used without a format string::
{{ value|time }}
{{ value|time }}
...
@@ -2051,6 +2065,11 @@ When used without a format string::
...
@@ -2051,6 +2065,11 @@ When used without a format string::
...the formatting string defined in the :setting:`TIME_FORMAT` setting will be
...the formatting string defined in the :setting:`TIME_FORMAT` setting will be
used, without applying any localization.
used, without applying any localization.
.. versionchanged:: 1.7
The ability to receive and act on values with attached timezone
information was added in Django 1.7.
.. templatefilter:: timesince
.. templatefilter:: timesince
timesince
timesince
...
...
docs/releases/1.7.txt
Dosyayı görüntüle @
bebb449a
...
@@ -301,6 +301,12 @@ Templates
...
@@ -301,6 +301,12 @@ Templates
* :func:`django.shortcuts.render()`
* :func:`django.shortcuts.render()`
* :func:`django.shortcuts.render_to_response()`
* :func:`django.shortcuts.render_to_response()`
* The :tfilter:`time` filter now accepts timzone-related :ref:`format
specifiers <date-and-time-formatting-specifiers>` ``'e'``, ``'O'`` , ``'T'``
and ``'Z'`` and is able to digest :ref:`time-zone-aware
<naive_vs_aware_datetimes>` ``datetime`` instances performing the expected
rendering.
Tests
Tests
^^^^^
^^^^^
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment