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
c3c7d15c
Kaydet (Commit)
c3c7d15c
authored
Haz 19, 2018
tarafından
Claude Paroz
Kaydeden (comit)
Tim Graham
Haz 20, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #29469 -- Reused get_app_config() error message in makemigrations error.
üst
abbc9cd7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
22 deletions
+13
-22
makemigrations.py
django/core/management/commands/makemigrations.py
+5
-14
test_commands.py
tests/migrations/test_commands.py
+8
-8
No files found.
django/core/management/commands/makemigrations.py
Dosyayı görüntüle @
c3c7d15c
...
...
@@ -65,23 +65,14 @@ class Command(BaseCommand):
# Make sure the app they asked for exists
app_labels
=
set
(
app_labels
)
bad_app_labels
=
set
()
has_bad_labels
=
False
for
app_label
in
app_labels
:
try
:
apps
.
get_app_config
(
app_label
)
except
LookupError
:
bad_app_labels
.
add
(
app_label
)
if
bad_app_labels
:
for
app_label
in
bad_app_labels
:
if
'.'
in
app_label
:
self
.
stderr
.
write
(
"'
%
s' is not a valid app label. Did you mean '
%
s'?"
%
(
app_label
,
app_label
.
split
(
'.'
)[
-
1
],
)
)
else
:
self
.
stderr
.
write
(
"App '
%
s' could not be found. Is it in INSTALLED_APPS?"
%
app_label
)
except
LookupError
as
err
:
self
.
stderr
.
write
(
str
(
err
))
has_bad_labels
=
True
if
has_bad_labels
:
sys
.
exit
(
2
)
# Load the current graph state. Pass in None for the connection so
...
...
tests/migrations/test_commands.py
Dosyayı görüntüle @
c3c7d15c
...
...
@@ -1408,20 +1408,20 @@ class AppLabelErrorTests(TestCase):
app. 'django.contrib.auth' must be in INSTALLED_APPS for some of these
tests.
"""
nonexistent_app_error
=
"No installed app with label 'nonexistent_app'."
did_you_mean_auth_error
=
(
"No installed app with label 'django.contrib.auth'. Did you mean "
"'auth'?"
)
def
test_makemigrations_nonexistent_app_label
(
self
):
err
=
io
.
StringIO
()
with
self
.
assertRaises
(
SystemExit
):
call_command
(
'makemigrations'
,
'nonexistent_app'
,
stderr
=
err
)
self
.
assertIn
(
"App 'nonexistent_app' could not be found. Is it in "
"INSTALLED_APPS?"
,
err
.
getvalue
()
)
self
.
assertIn
(
self
.
nonexistent_app_error
,
err
.
getvalue
())
def
test_makemigrations_app_name_specified_as_label
(
self
):
err
=
io
.
StringIO
()
with
self
.
assertRaises
(
SystemExit
):
call_command
(
'makemigrations'
,
'django.contrib.auth'
,
stderr
=
err
)
self
.
assertIn
(
"'django.contrib.auth' is not a valid app label. Did you mean 'auth'?"
,
err
.
getvalue
()
)
self
.
assertIn
(
self
.
did_you_mean_auth_error
,
err
.
getvalue
())
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