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
beffa061
Kaydet (Commit)
beffa061
authored
Eyl 14, 2018
tarafından
Adam Johnson
Kaydeden (comit)
Tim Graham
Eyl 18, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Made various edits to docs/ref/utils.txt.
üst
8aad4a38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
23 deletions
+28
-23
utils.txt
docs/ref/utils.txt
+28
-23
No files found.
docs/ref/utils.txt
Dosyayı görüntüle @
beffa061
...
@@ -16,10 +16,10 @@ the :ref:`internal release deprecation policy <internal-release-deprecation-poli
...
@@ -16,10 +16,10 @@ the :ref:`internal release deprecation policy <internal-release-deprecation-poli
.. module:: django.utils.cache
.. module:: django.utils.cache
:synopsis: Helper functions for controlling caching.
:synopsis: Helper functions for controlling caching.
This module contains helper functions for controlling
caching. It does so by
This module contains helper functions for controlling
HTTP caching. It does so
managing the ``Vary`` header of responses. It includes functions to patch the
by managing the ``Vary`` header of responses. It includes functions to patch
header of response objects directly and decorators that change functions to d
o
the header of response objects directly and decorators that change functions t
o
that header-patching themselves.
do
that header-patching themselves.
For information on the ``Vary`` header, see :rfc:`7231#section-7.1.4`.
For information on the ``Vary`` header, see :rfc:`7231#section-7.1.4`.
...
@@ -99,10 +99,13 @@ need to distinguish caches by the ``Accept-language`` header.
...
@@ -99,10 +99,13 @@ need to distinguish caches by the ``Accept-language`` header.
==========================
==========================
.. module:: django.utils.dateparse
.. module:: django.utils.dateparse
:synopsis: Functions to parse datetime objects.
:synopsis: Functions to parse
strings to
datetime objects.
The functions defined in this module share the following properties:
The functions defined in this module share the following properties:
- They accept strings in ISO 8601 date/time formats (or some close
alternatives) and return objects from the corresponding classes in Python's
:mod:`datetime` module.
- They raise :exc:`ValueError` if their input is well formatted but isn't a
- They raise :exc:`ValueError` if their input is well formatted but isn't a
valid date or time.
valid date or time.
- They return ``None`` if it isn't well formatted at all.
- They return ``None`` if it isn't well formatted at all.
...
@@ -199,8 +202,8 @@ The functions defined in this module share the following properties:
...
@@ -199,8 +202,8 @@ The functions defined in this module share the following properties:
.. function:: smart_text(s, encoding='utf-8', strings_only=False, errors='strict')
.. function:: smart_text(s, encoding='utf-8', strings_only=False, errors='strict')
Returns a ``str`` object representing
``s``. Treats bytestrings using the
Returns a ``str`` object representing
arbitrary object ``s``. Treats
``encoding`` codec.
bytestrings using the
``encoding`` codec.
If ``strings_only`` is ``True``, don't convert (some) non-string-like
If ``strings_only`` is ``True``, don't convert (some) non-string-like
objects.
objects.
...
@@ -222,8 +225,8 @@ The functions defined in this module share the following properties:
...
@@ -222,8 +225,8 @@ The functions defined in this module share the following properties:
.. function:: smart_bytes(s, encoding='utf-8', strings_only=False, errors='strict')
.. function:: smart_bytes(s, encoding='utf-8', strings_only=False, errors='strict')
Returns a bytestring version of
``s``, encoded as specified in
Returns a bytestring version of
arbitrary object ``s``, encoded as
``encoding``.
specified in
``encoding``.
If ``strings_only`` is ``True``, don't convert (some) non-string-like
If ``strings_only`` is ``True``, don't convert (some) non-string-like
objects.
objects.
...
@@ -468,7 +471,7 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004
...
@@ -468,7 +471,7 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004
...
...
Note that as the method is now a property, in Python code it will need to
Note that as the method is now a property, in Python code it will need to
be
invok
ed appropriately::
be
access
ed appropriately::
# in the view:
# in the view:
if person.friends:
if person.friends:
...
@@ -822,25 +825,27 @@ appropriate entities.
...
@@ -822,25 +825,27 @@ appropriate entities.
is translated to "persona", the regular expression will match
is translated to "persona", the regular expression will match
``persona/(?P<pk>\d+)/$``, e.g. ``persona/5/``.
``persona/(?P<pk>\d+)/$``, e.g. ``persona/5/``.
.. function:: slugify(allow_unicode=False)
.. function:: slugify(
value,
allow_unicode=False)
Converts to ASCII if ``allow_unicode`` is ``False`` (default). Converts spaces to
Converts a string to a URL slug by:
hyphens. Removes characters that aren't alphanumerics, underscores, or
hyphens. Converts to lowercase. Also strips leading and trailing whitespace.
For example::
#. Converting to ASCII if ``allow_unicode`` is ``False`` (the default).
#. Removing characters that aren't alphanumerics, underscores, hyphens, or
slugify(value)
whitespace.
#. Removing leading and trailing whitespace.
#. Converting to lowercase.
#. Replacing any whitespace or repeated dashes with single dashes.
If ``value`` is ``"Joel is a slug"``, the output will be
For example::
``"joel-is-a-slug"``.
You can set the ``allow_unicode`` parameter to ``True``, if you want to
>>> slugify(' Joel is a slug ')
allow Unicode characters::
'joel-is-a-slug'
slugify(value, allow_unicode=True)
If you want to allow Unicode characters, pass ``allow_unicode=True``. For
example::
If ``value`` is ``"你好 World"``, the output will be ``"你好-world"``.
>>> slugify('你好 World', allow_unicode=True)
'你好-world'
.. _time-zone-selection-functions:
.. _time-zone-selection-functions:
...
...
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