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
10d82c85
Kaydet (Commit)
10d82c85
authored
Eki 19, 2018
tarafından
Prabakaran Kumaresshan
Kaydeden (comit)
Tim Graham
Eki 23, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29831 -- Added validation for makemigrations --name.
üst
136a900e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
makemigrations.py
django/core/management/commands/makemigrations.py
+2
-0
django-admin.txt
docs/ref/django-admin.txt
+2
-1
test_commands.py
tests/migrations/test_commands.py
+5
-0
No files found.
django/core/management/commands/makemigrations.py
Dosyayı görüntüle @
10d82c85
...
@@ -61,6 +61,8 @@ class Command(BaseCommand):
...
@@ -61,6 +61,8 @@ class Command(BaseCommand):
self
.
merge
=
options
[
'merge'
]
self
.
merge
=
options
[
'merge'
]
self
.
empty
=
options
[
'empty'
]
self
.
empty
=
options
[
'empty'
]
self
.
migration_name
=
options
[
'name'
]
self
.
migration_name
=
options
[
'name'
]
if
self
.
migration_name
and
not
self
.
migration_name
.
isidentifier
():
raise
CommandError
(
'The migration name must be a valid Python identifier.'
)
check_changes
=
options
[
'check_changes'
]
check_changes
=
options
[
'check_changes'
]
# Make sure the app they asked for exists
# Make sure the app they asked for exists
...
...
docs/ref/django-admin.txt
Dosyayı görüntüle @
10d82c85
...
@@ -756,7 +756,8 @@ Enables fixing of migration conflicts.
...
@@ -756,7 +756,8 @@ Enables fixing of migration conflicts.
.. django-admin-option:: --name NAME, -n NAME
.. django-admin-option:: --name NAME, -n NAME
Allows naming the generated migration(s) instead of using a generated name.
Allows naming the generated migration(s) instead of using a generated name. The
name must be a valid Python :ref:`identifier <python:identifiers>`.
.. django-admin-option:: --check
.. django-admin-option:: --check
...
...
tests/migrations/test_commands.py
Dosyayı görüntüle @
10d82c85
...
@@ -1352,6 +1352,11 @@ class MakeMigrationsTests(MigrationTestBase):
...
@@ -1352,6 +1352,11 @@ class MakeMigrationsTests(MigrationTestBase):
self
.
assertIn
(
"dependencies=[
\n
('migrations','0001_
%
s'),
\n
]"
%
migration_name_0001
,
content
)
self
.
assertIn
(
"dependencies=[
\n
('migrations','0001_
%
s'),
\n
]"
%
migration_name_0001
,
content
)
self
.
assertIn
(
"operations=[
\n
]"
,
content
)
self
.
assertIn
(
"operations=[
\n
]"
,
content
)
def
test_makemigrations_with_invalid_custom_name
(
self
):
msg
=
'The migration name must be a valid Python identifier.'
with
self
.
assertRaisesMessage
(
CommandError
,
msg
):
call_command
(
'makemigrations'
,
'migrations'
,
'--name'
,
'invalid name'
,
'--empty'
)
def
test_makemigrations_check
(
self
):
def
test_makemigrations_check
(
self
):
"""
"""
makemigrations --check should exit with a non-zero status when
makemigrations --check should exit with a non-zero status when
...
...
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