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
1a9bd75b
Kaydet (Commit)
1a9bd75b
authored
Kas 30, 2016
tarafından
Lex Berezhny
Kaydeden (comit)
Tim Graham
Kas 30, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #27358 -- Fixed system check crash with an empty FileField.upload_to.
üst
ddf169cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
files.py
django/db/models/fields/files.py
+1
-1
test_ordinary_fields.py
tests/invalid_models_tests/test_ordinary_fields.py
+6
-0
No files found.
django/db/models/fields/files.py
Dosyayı görüntüle @
1a9bd75b
...
...
@@ -256,7 +256,7 @@ class FileField(Field):
return
[]
def
_check_upload_to
(
self
):
if
isinstance
(
self
.
upload_to
,
six
.
string_types
)
and
self
.
upload_to
[
0
]
==
'/'
:
if
isinstance
(
self
.
upload_to
,
six
.
string_types
)
and
self
.
upload_to
.
startswith
(
'/'
)
:
return
[
checks
.
Error
(
"
%
s's 'upload_to' argument must be a relative path, not an "
...
...
tests/invalid_models_tests/test_ordinary_fields.py
Dosyayı görüntüle @
1a9bd75b
...
...
@@ -431,6 +431,12 @@ class DecimalFieldTests(SimpleTestCase):
@isolate_apps
(
'invalid_models_tests'
)
class
FileFieldTests
(
SimpleTestCase
):
def
test_valid_default_case
(
self
):
class
Model
(
models
.
Model
):
field
=
models
.
FileField
()
self
.
assertEqual
(
Model
.
_meta
.
get_field
(
'field'
)
.
check
(),
[])
def
test_valid_case
(
self
):
class
Model
(
models
.
Model
):
field
=
models
.
FileField
(
upload_to
=
'somewhere'
)
...
...
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