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
89e2c60f
Kaydet (Commit)
89e2c60f
authored
Ara 27, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24000 -- Corrected contrib.sites default site creation in a multiple database setup.
üst
e112bacd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
management.py
django/contrib/sites/management.py
+5
-5
tests.py
django/contrib/sites/tests.py
+2
-2
1.7.2.txt
docs/releases/1.7.2.txt
+3
-0
No files found.
django/contrib/sites/management.py
Dosyayı görüntüle @
89e2c60f
...
...
@@ -8,13 +8,13 @@ from django.core.management.color import no_style
from
django.db
import
DEFAULT_DB_ALIAS
,
connections
,
router
def
create_default_site
(
app_config
,
verbosity
=
2
,
interactive
=
True
,
db
=
DEFAULT_DB_ALIAS
,
**
kwargs
):
def
create_default_site
(
app_config
,
verbosity
=
2
,
interactive
=
True
,
using
=
DEFAULT_DB_ALIAS
,
**
kwargs
):
try
:
Site
=
apps
.
get_model
(
'sites'
,
'Site'
)
except
LookupError
:
return
if
not
router
.
allow_migrate
(
db
,
Site
):
if
not
router
.
allow_migrate
(
using
,
Site
):
return
if
not
Site
.
objects
.
exists
():
...
...
@@ -25,14 +25,14 @@ def create_default_site(app_config, verbosity=2, interactive=True, db=DEFAULT_DB
# can also crop up outside of tests - see #15346.
if
verbosity
>=
2
:
print
(
"Creating example.com Site object"
)
Site
(
pk
=
settings
.
SITE_ID
,
domain
=
"example.com"
,
name
=
"example.com"
)
.
save
(
using
=
db
)
Site
(
pk
=
settings
.
SITE_ID
,
domain
=
"example.com"
,
name
=
"example.com"
)
.
save
(
using
=
using
)
# We set an explicit pk instead of relying on auto-incrementation,
# so we need to reset the database sequence. See #17415.
sequence_sql
=
connections
[
db
]
.
ops
.
sequence_reset_sql
(
no_style
(),
[
Site
])
sequence_sql
=
connections
[
using
]
.
ops
.
sequence_reset_sql
(
no_style
(),
[
Site
])
if
sequence_sql
:
if
verbosity
>=
2
:
print
(
"Resetting sequence"
)
with
connections
[
db
]
.
cursor
()
as
cursor
:
with
connections
[
using
]
.
cursor
()
as
cursor
:
for
command
in
sequence_sql
:
cursor
.
execute
(
command
)
django/contrib/sites/tests.py
Dosyayı görüntüle @
89e2c60f
...
...
@@ -151,8 +151,8 @@ class CreateDefaultSiteTests(TestCase):
"""
#16353, #16828 - The default site creation should respect db routing.
"""
create_default_site
(
self
.
app_config
,
db
=
'default'
,
verbosity
=
0
)
create_default_site
(
self
.
app_config
,
db
=
'other'
,
verbosity
=
0
)
create_default_site
(
self
.
app_config
,
using
=
'default'
,
verbosity
=
0
)
create_default_site
(
self
.
app_config
,
using
=
'other'
,
verbosity
=
0
)
self
.
assertFalse
(
Site
.
objects
.
using
(
'default'
)
.
exists
())
self
.
assertTrue
(
Site
.
objects
.
using
(
'other'
)
.
exists
())
...
...
docs/releases/1.7.2.txt
Dosyayı görüntüle @
89e2c60f
...
...
@@ -172,3 +172,6 @@ Bugfixes
(:ticket:`24054`).
* Added tablespace SQL to apps with migrations (:ticket:`24051`).
* Corrected ``contrib.sites`` default site creation in a multiple database
setup (:ticket:`24000`).
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