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
50f9e736
Kaydet (Commit)
50f9e736
authored
Kas 05, 2016
tarafından
Paweł Marczewski
Kaydeden (comit)
Tim Graham
Kas 10, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27438 -- Added the diffsettings --default option.
üst
373c6c40
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
3 deletions
+35
-3
diffsettings.py
django/core/management/commands/diffsettings.py
+10
-2
django-admin.txt
docs/ref/django-admin.txt
+8
-1
1.11.txt
docs/releases/1.11.txt
+3
-0
tests.py
tests/admin_scripts/tests.py
+14
-0
No files found.
django/core/management/commands/diffsettings.py
Dosyayı görüntüle @
50f9e736
...
...
@@ -18,16 +18,24 @@ class Command(BaseCommand):
'--all'
,
action
=
'store_true'
,
dest
=
'all'
,
default
=
False
,
help
=
'Display all settings, regardless of their value. Default values are prefixed by "###".'
,
)
parser
.
add_argument
(
'--default'
,
dest
=
'default'
,
metavar
=
'MODULE'
,
default
=
None
,
help
=
(
"The settings module to compare the current settings against. Leave empty to "
"compare against Django's default settings."
),
)
def
handle
(
self
,
**
options
):
# Inspired by Postfix's "postconf -n".
from
django.conf
import
settings
,
global_settings
from
django.conf
import
settings
,
Settings
,
global_settings
# Because settings are imported lazily, we need to explicitly load them.
settings
.
_setup
()
user_settings
=
module_to_dict
(
settings
.
_wrapped
)
default_settings
=
module_to_dict
(
global_settings
)
default
=
options
[
'default'
]
default_settings
=
module_to_dict
(
Settings
(
default
)
if
default
else
global_settings
)
output
=
[]
for
key
in
sorted
(
user_settings
):
...
...
docs/ref/django-admin.txt
Dosyayı görüntüle @
50f9e736
...
...
@@ -223,7 +223,7 @@ Specifies the database onto which to open a shell. Defaults to ``default``.
.. django-admin:: diffsettings
Displays differences between the current settings file and Django's default
settings.
settings
(or another settings file specified by :option:`--default`)
.
Settings that don't appear in the defaults are followed by ``"###"``. For
example, the default settings don't define :setting:`ROOT_URLCONF`, so
...
...
@@ -235,6 +235,13 @@ example, the default settings don't define :setting:`ROOT_URLCONF`, so
Displays all settings, even if they have Django's default value. Such settings
are prefixed by ``"###"``.
.. django-admin-option:: --default MODULE
.. versionadded:: 1.11
The settings module to compare the current settings against. Leave empty to
compare against Django's default settings.
``dumpdata``
------------
...
...
docs/releases/1.11.txt
Dosyayı görüntüle @
50f9e736
...
...
@@ -281,6 +281,9 @@ Management Commands
* The new :option:`loaddata --exclude` option allows excluding models and apps
while loading data from fixtures.
* The new :option:`diffsettings --default` option allows specifying a settings
module other than Django's default settings to compare against.
Migrations
~~~~~~~~~~
...
...
tests/admin_scripts/tests.py
Dosyayı görüntüle @
50f9e736
...
...
@@ -2128,6 +2128,20 @@ class DiffSettings(AdminScriptTestCase):
self
.
assertNoOutput
(
err
)
self
.
assertOutput
(
out
,
"### STATIC_URL = None"
)
def
test_custom_default
(
self
):
"""
The --default option specifies an alternate settings module for
comparison.
"""
self
.
write_settings
(
'settings_default.py'
,
sdict
=
{
'FOO'
:
'"foo"'
,
'BAR'
:
'"bar1"'
})
self
.
addCleanup
(
self
.
remove_settings
,
'settings_default.py'
)
self
.
write_settings
(
'settings_to_diff.py'
,
sdict
=
{
'FOO'
:
'"foo"'
,
'BAR'
:
'"bar2"'
})
self
.
addCleanup
(
self
.
remove_settings
,
'settings_to_diff.py'
)
out
,
err
=
self
.
run_manage
([
'diffsettings'
,
'--settings=settings_to_diff'
,
'--default=settings_default'
])
self
.
assertNoOutput
(
err
)
self
.
assertNotInOutput
(
out
,
"FOO"
)
self
.
assertOutput
(
out
,
"BAR = 'bar2'"
)
class
Dumpdata
(
AdminScriptTestCase
):
"""Tests for dumpdata management command."""
...
...
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