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
bad5f262
Kaydet (Commit)
bad5f262
authored
Şub 16, 2015
tarafından
Anssi Kääriäinen
Kaydeden (comit)
Tim Graham
Şub 20, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24328 -- cleaned up Options._get_fields() implementation
üst
bed504d7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
12 deletions
+20
-12
base.py
django/db/models/base.py
+2
-1
options.py
django/db/models/options.py
+0
-0
tests.py
tests/model_meta/tests.py
+5
-8
models.py
tests/proxy_models/models.py
+1
-1
tests.py
tests/proxy_models/tests.py
+12
-2
No files found.
django/db/models/base.py
Dosyayı görüntüle @
bad5f262
...
...
@@ -239,7 +239,8 @@ class ModelBase(type):
else
:
# .. and abstract ones.
for
field
in
parent_fields
:
new_class
.
add_to_class
(
field
.
name
,
copy
.
deepcopy
(
field
))
new_field
=
copy
.
deepcopy
(
field
)
new_class
.
add_to_class
(
field
.
name
,
new_field
)
# Pass any non-abstract parent classes onto child.
new_class
.
_meta
.
parents
.
update
(
base
.
_meta
.
parents
)
...
...
django/db/models/options.py
Dosyayı görüntüle @
bad5f262
This diff is collapsed.
Click to expand it.
tests/model_meta/tests.py
Dosyayı görüntüle @
bad5f262
...
...
@@ -228,11 +228,9 @@ class RelationTreeTests(TestCase):
sorted
([
field
.
related_query_name
()
for
field
in
Relation
.
_meta
.
_relation_tree
if
not
field
.
rel
.
field
.
rel
.
is_hidden
()]),
sorted
([
'fk_abstract_rel'
,
'fk_abstract_rel'
,
'fk_abstract_rel'
,
'fk_base_rel'
,
'fk_base_rel'
,
'fk_base_rel'
,
'fk_concrete_rel'
,
'fk_concrete_rel'
,
'fo_abstract_rel'
,
'fo_abstract_rel'
,
'fo_abstract_rel'
,
'fo_base_rel'
,
'fo_base_rel'
,
'fo_base_rel'
,
'fo_concrete_rel'
,
'fo_concrete_rel'
,
'm2m_abstract_rel'
,
'm2m_abstract_rel'
,
'm2m_abstract_rel'
,
'm2m_base_rel'
,
'm2m_base_rel'
,
'm2m_base_rel'
,
'm2m_concrete_rel'
,
'm2m_concrete_rel'
,
'fk_abstract_rel'
,
'fk_base_rel'
,
'fk_concrete_rel'
,
'fo_abstract_rel'
,
'fo_base_rel'
,
'fo_concrete_rel'
,
'm2m_abstract_rel'
,
'm2m_base_rel'
,
'm2m_concrete_rel'
])
)
# Testing hidden related objects
...
...
@@ -243,9 +241,8 @@ class RelationTreeTests(TestCase):
'BasePerson_following_base+'
,
'BasePerson_following_base+'
,
'BasePerson_friends_abstract+'
,
'BasePerson_friends_abstract+'
,
'BasePerson_friends_base+'
,
'BasePerson_friends_base+'
,
'BasePerson_m2m_abstract+'
,
'BasePerson_m2m_base+'
,
'Relating_basepeople+'
,
'Relating_basepeople_hidden+'
,
'followers_abstract'
,
'followers_abstract'
,
'followers_abstract'
,
'followers_base'
,
'followers_base'
,
'followers_base'
,
'friends_abstract_rel_+'
,
'friends_abstract_rel_+'
,
'friends_abstract_rel_+'
,
'friends_base_rel_+'
,
'friends_base_rel_+'
,
'friends_base_rel_+'
,
'person'
,
'Relating_basepeople_hidden+'
,
'followers_abstract'
,
'followers_base'
,
'friends_abstract_rel_+'
,
'friends_base_rel_+'
,
'person'
,
'relating_basepeople'
,
'relating_baseperson'
,
])
)
...
...
tests/proxy_models/models.py
Dosyayı görüntüle @
bad5f262
...
...
@@ -158,7 +158,7 @@ class ProxyTrackerUser(TrackerUser):
@python_2_unicode_compatible
class
Issue
(
models
.
Model
):
summary
=
models
.
CharField
(
max_length
=
255
)
assignee
=
models
.
ForeignKey
(
TrackerUser
)
assignee
=
models
.
ForeignKey
(
Proxy
TrackerUser
)
def
__str__
(
self
):
return
':'
.
join
((
self
.
__class__
.
__name__
,
self
.
summary
,))
...
...
tests/proxy_models/tests.py
Dosyayı görüntüle @
bad5f262
...
...
@@ -3,7 +3,7 @@ from __future__ import unicode_literals
from
django.apps
import
apps
from
django.contrib
import
admin
from
django.contrib.contenttypes.models
import
ContentType
from
django.core
import
checks
,
management
from
django.core
import
checks
,
exceptions
,
management
from
django.core.urlresolvers
import
reverse
from
django.db
import
DEFAULT_DB_ALIAS
,
models
from
django.db.models
import
signals
...
...
@@ -328,8 +328,18 @@ class ProxyModelTests(TestCase):
resp
=
StateProxy
.
objects
.
select_related
()
.
get
(
name
=
'New South Wales'
)
self
.
assertEqual
(
resp
.
name
,
'New South Wales'
)
def
test_filter_proxy_relation_reverse
(
self
):
tu
=
TrackerUser
.
objects
.
create
(
name
=
'Contributor'
,
status
=
'contrib'
)
with
self
.
assertRaises
(
exceptions
.
FieldError
):
TrackerUser
.
objects
.
filter
(
issue
=
None
),
self
.
assertQuerysetEqual
(
ProxyTrackerUser
.
objects
.
filter
(
issue
=
None
),
[
tu
],
lambda
x
:
x
)
def
test_proxy_bug
(
self
):
contributor
=
TrackerUser
.
objects
.
create
(
name
=
'Contributor'
,
contributor
=
Proxy
TrackerUser
.
objects
.
create
(
name
=
'Contributor'
,
status
=
'contrib'
)
someone
=
BaseUser
.
objects
.
create
(
name
=
'Someone'
)
Bug
.
objects
.
create
(
summary
=
'fix this'
,
version
=
'1.1beta'
,
...
...
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