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
9e5e5a65
Kaydet (Commit)
9e5e5a65
authored
Ock 16, 2019
tarafından
Simon Charette
Kaydeden (comit)
Tim Graham
Ock 16, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #30044 -- Raised a FieldError on inherited field update attempts.
üst
4fc35a9c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
query.py
django/db/models/sql/query.py
+2
-0
models.py
tests/expressions/models.py
+4
-0
tests.py
tests/expressions/tests.py
+7
-2
No files found.
django/db/models/sql/query.py
Dosyayı görüntüle @
9e5e5a65
...
...
@@ -1600,6 +1600,8 @@ class Query:
field_list
=
name
.
split
(
LOOKUP_SEP
)
join_info
=
self
.
setup_joins
(
field_list
,
self
.
get_meta
(),
self
.
get_initial_alias
(),
can_reuse
=
reuse
)
targets
,
final_alias
,
join_list
=
self
.
trim_joins
(
join_info
.
targets
,
join_info
.
joins
,
join_info
.
path
)
if
not
allow_joins
and
len
(
join_list
)
>
1
:
raise
FieldError
(
'Joined field references are not permitted in this query'
)
if
len
(
targets
)
>
1
:
raise
FieldError
(
"Referencing multicolumn fields with F() objects "
"isn't supported"
)
...
...
tests/expressions/models.py
Dosyayı görüntüle @
9e5e5a65
...
...
@@ -15,6 +15,10 @@ class Employee(models.Model):
return
'
%
s
%
s'
%
(
self
.
firstname
,
self
.
lastname
)
class
RemoteEmployee
(
Employee
):
adjusted_salary
=
models
.
IntegerField
()
class
Company
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
)
num_employees
=
models
.
PositiveIntegerField
()
...
...
tests/expressions/tests.py
Dosyayı görüntüle @
9e5e5a65
...
...
@@ -24,8 +24,8 @@ from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from
django.test.utils
import
Approximate
from
.models
import
(
UUID
,
UUIDPK
,
Company
,
Employee
,
Experiment
,
Number
,
Re
sult
,
SimulationRun
,
Time
,
UUID
,
UUIDPK
,
Company
,
Employee
,
Experiment
,
Number
,
Re
moteEmployee
,
Result
,
SimulationRun
,
Time
,
)
...
...
@@ -285,6 +285,11 @@ class BasicExpressionsTests(TestCase):
with
self
.
assertRaisesMessage
(
FieldError
,
msg
):
test_gmbh
.
save
()
def
test_update_inherited_field_value
(
self
):
msg
=
'Joined field references are not permitted in this query'
with
self
.
assertRaisesMessage
(
FieldError
,
msg
):
RemoteEmployee
.
objects
.
update
(
adjusted_salary
=
F
(
'salary'
)
*
5
)
def
test_object_update_unsaved_objects
(
self
):
# F expressions cannot be used to update attributes on objects which do
# not yet exist in the database
...
...
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