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
d72f83c4
Kaydet (Commit)
d72f83c4
authored
Agu 29, 2013
tarafından
Jorge C. Leitão
Kaydeden (comit)
Tim Graham
Agu 29, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added links to file docs.
üst
c7d0ff0c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
file.txt
docs/ref/files/file.txt
+13
-13
No files found.
docs/ref/files/file.txt
Dosyayı görüntüle @
d72f83c4
...
...
@@ -11,15 +11,15 @@ The ``File`` Class
.. class:: File(file_object)
The :class:`File`
is a thin wrapper around Python's built-in file object
with some Django-specific additions. Internally, Django uses this class
any time
it needs to represent a file.
The :class:`File`
class is a thin wrapper around Python's :py:ref:`built-in
file object<bltin-file-objects>` with some Django-specific additions.
Internally, Django uses this class when
it needs to represent a file.
:class:`File` objects have the following attributes and methods:
.. attribute:: name
The name of file including the relative path from
The name of
the
file including the relative path from
:setting:`MEDIA_ROOT`.
.. attribute:: size
...
...
@@ -28,8 +28,8 @@ The ``File`` Class
.. attribute:: file
The underlying
Python ``file`` object passed to
:class:`~django.core.files.File`
.
The underlying
:py:ref:`built-in file object<bltin-file-objects>` that
this class wraps
.
.. attribute:: mode
...
...
@@ -37,9 +37,9 @@ The ``File`` Class
.. method:: open([mode=None])
Open or reopen the file (which
by definition also does
``File.seek(0)``).
The ``mode`` argument allows the same values
as Python's
standard ``open()`
`.
Open or reopen the file (which
also does ``File.seek(0)``).
The ``mode`` argument allows the same values
as Python's
built-in :func:`python:open()
`.
When reopening a file, ``mode`` will override whatever mode the file
was originally opened with; ``None`` means to reopen with the original
...
...
@@ -71,14 +71,14 @@ The ``File`` Class
Writes the specified content string to the file. Depending on the
storage system behind the scenes, this content might not be fully
committed until
``close()`
` is called on the file.
committed until
:func:`close()
` is called on the file.
.. method:: close()
Close the file.
In addition to the listed methods, :class:`~django.core.files.File` exposes
the following attributes and methods of
the underlying
``file`` object:
the following attributes and methods of
its
``file`` object:
``encoding``, ``fileno``, ``flush``, ``isatty``, ``newlines``,
``read``, ``readinto``, ``readlines``, ``seek``, ``softspace``, ``tell``,
``truncate``, ``writelines``, ``xreadlines``.
...
...
@@ -125,7 +125,7 @@ The ``ImageFile`` Class
Additional methods on files attached to objects
-----------------------------------------------
Any :class:`File` that
'
s associated with an object (as with ``Car.photo``,
Any :class:`File` that
i
s associated with an object (as with ``Car.photo``,
below) will also have a couple of extra methods:
.. method:: File.save(name, content, [save=True])
...
...
@@ -138,7 +138,7 @@ below) will also have a couple of extra methods:
>>> car.photo.save('myphoto.jpg', content, save=False)
>>> car.save()
are
the same as this one line
::
are
equivalent to
::
>>> car.photo.save('myphoto.jpg', content, save=True)
...
...
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