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
07a73a27
Kaydet (Commit)
07a73a27
authored
Nis 30, 2013
tarafından
Dan Loewenherz
Kaydeden (comit)
Tim Graham
Haz 01, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #20337 -- Clarified error message when database relation is not allowed.
üst
127d9b27
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
related.py
django/db/models/fields/related.py
+2
-4
No files found.
django/db/models/fields/related.py
Dosyayı görüntüle @
07a73a27
...
...
@@ -228,8 +228,7 @@ class SingleRelatedObjectDescriptor(six.with_metaclass(RenameRelatedObjectDescri
value
.
_state
.
db
=
router
.
db_for_write
(
value
.
__class__
,
instance
=
instance
)
elif
value
.
_state
.
db
is
not
None
and
instance
.
_state
.
db
is
not
None
:
if
not
router
.
allow_relation
(
value
,
instance
):
raise
ValueError
(
'Cannot assign "
%
r": instance is on database "
%
s", value is on database "
%
s"'
%
(
value
,
instance
.
_state
.
db
,
value
.
_state
.
db
))
raise
ValueError
(
'Cannot assign "
%
r": the current database router prevents this relation.'
%
value
)
related_pk
=
tuple
([
getattr
(
instance
,
field
.
attname
)
for
field
in
self
.
related
.
field
.
foreign_related_fields
])
if
None
in
related_pk
:
...
...
@@ -328,8 +327,7 @@ class ReverseSingleRelatedObjectDescriptor(six.with_metaclass(RenameRelatedObjec
value
.
_state
.
db
=
router
.
db_for_write
(
value
.
__class__
,
instance
=
instance
)
elif
value
.
_state
.
db
is
not
None
and
instance
.
_state
.
db
is
not
None
:
if
not
router
.
allow_relation
(
value
,
instance
):
raise
ValueError
(
'Cannot assign "
%
r": instance is on database "
%
s", value is on database "
%
s"'
%
(
value
,
instance
.
_state
.
db
,
value
.
_state
.
db
))
raise
ValueError
(
'Cannot assign "
%
r": the current database router prevents this relation.'
%
value
)
# If we're setting the value of a OneToOneField to None, we need to clear
# out the cache on any old related object. Otherwise, deleting the
...
...
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