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
839940f2
Kaydet (Commit)
839940f2
authored
Agu 20, 2013
tarafından
Florian Apolloner
Kaydeden (comit)
Andrew Godwin
Agu 21, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #20933 -- Allowed loaddata to load fixtures from relative paths.
üst
1db5fce1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
10 deletions
+19
-10
loaddata.py
django/core/management/commands/loaddata.py
+1
-1
initial-data.txt
docs/howto/initial-data.txt
+2
-2
models.py
tests/fixtures_regress/models.py
+0
-6
tests.py
tests/fixtures_regress/tests.py
+16
-1
No files found.
django/core/management/commands/loaddata.py
Dosyayı görüntüle @
839940f2
...
...
@@ -183,7 +183,7 @@ class Command(BaseCommand):
if
self
.
verbosity
>=
2
:
self
.
stdout
.
write
(
"Loading '
%
s' fixtures..."
%
fixture_name
)
if
os
.
path
.
isabs
(
fixture_name
)
:
if
os
.
path
.
sep
in
fixture_name
:
fixture_dirs
=
[
os
.
path
.
dirname
(
fixture_name
)]
fixture_name
=
os
.
path
.
basename
(
fixture_name
)
else
:
...
...
docs/howto/initial-data.txt
Dosyayı görüntüle @
839940f2
...
...
@@ -90,8 +90,8 @@ fixtures. You can set the :setting:`FIXTURE_DIRS` setting to a list of
additional directories where Django should look.
When running :djadmin:`manage.py loaddata <loaddata>`, you can also
specify a
n absolute path to a fixture file, which overrides searching
the usual
directories.
specify a
path to a fixture file, which overrides searching the usual
directories.
.. seealso::
...
...
tests/fixtures_regress/models.py
Dosyayı görüntüle @
839940f2
...
...
@@ -39,12 +39,6 @@ class Stuff(models.Model):
class
Absolute
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
40
)
load_count
=
0
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
Absolute
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
Absolute
.
load_count
+=
1
class
Parent
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
10
)
...
...
tests/fixtures_regress/tests.py
Dosyayı görüntüle @
839940f2
...
...
@@ -148,7 +148,22 @@ class TestFixtures(TestCase):
load_absolute_path
,
verbosity
=
0
,
)
self
.
assertEqual
(
Absolute
.
load_count
,
1
)
self
.
assertEqual
(
Absolute
.
objects
.
count
(),
1
)
def
test_relative_path
(
self
):
directory
=
os
.
path
.
dirname
(
upath
(
__file__
))
relative_path
=
os
.
path
.
join
(
'fixtures'
,
'absolute.json'
)
cwd
=
os
.
getcwd
()
try
:
os
.
chdir
(
directory
)
management
.
call_command
(
'loaddata'
,
relative_path
,
verbosity
=
0
,
)
finally
:
os
.
chdir
(
cwd
)
self
.
assertEqual
(
Absolute
.
objects
.
count
(),
1
)
def
test_unknown_format
(
self
):
"""
...
...
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