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
2456276b
Kaydet (Commit)
2456276b
authored
May 27, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[1.8.x] Fixed #24851 -- Fixed crash with reverse one-to-one relation in ModelAdmin.list_display
üst
f65d4db8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
6 deletions
+18
-6
admin_list.py
django/contrib/admin/templatetags/admin_list.py
+1
-1
main.py
django/contrib/admin/views/main.py
+1
-1
1.8.3.txt
docs/releases/1.8.3.txt
+3
-0
admin.py
tests/admin_changelist/admin.py
+1
-1
models.py
tests/admin_changelist/models.py
+4
-0
tests.py
tests/admin_changelist/tests.py
+8
-3
No files found.
django/contrib/admin/templatetags/admin_list.py
Dosyayı görüntüle @
2456276b
...
@@ -200,7 +200,7 @@ def items_for_result(cl, result, form):
...
@@ -200,7 +200,7 @@ def items_for_result(cl, result, form):
except
ObjectDoesNotExist
:
except
ObjectDoesNotExist
:
result_repr
=
EMPTY_CHANGELIST_VALUE
result_repr
=
EMPTY_CHANGELIST_VALUE
else
:
else
:
if
f
is
None
:
if
f
is
None
or
f
.
auto_created
:
if
field_name
==
'action_checkbox'
:
if
field_name
==
'action_checkbox'
:
row_classes
=
[
'action-checkbox'
]
row_classes
=
[
'action-checkbox'
]
allow_tags
=
getattr
(
attr
,
'allow_tags'
,
False
)
allow_tags
=
getattr
(
attr
,
'allow_tags'
,
False
)
...
...
django/contrib/admin/views/main.py
Dosyayı görüntüle @
2456276b
...
@@ -383,7 +383,7 @@ class ChangeList(object):
...
@@ -383,7 +383,7 @@ class ChangeList(object):
except
FieldDoesNotExist
:
except
FieldDoesNotExist
:
pass
pass
else
:
else
:
if
isinstance
(
field
.
rel
,
models
.
ManyToOneRel
):
if
hasattr
(
field
,
'rel'
)
and
isinstance
(
field
.
rel
,
models
.
ManyToOneRel
):
return
True
return
True
return
False
return
False
...
...
docs/releases/1.8.3.txt
Dosyayı görüntüle @
2456276b
...
@@ -28,3 +28,6 @@ Bugfixes
...
@@ -28,3 +28,6 @@ Bugfixes
* Prevented the loss of ``null``/``not null`` column properties during field
* Prevented the loss of ``null``/``not null`` column properties during field
renaming of MySQL databases (:ticket:`24817`).
renaming of MySQL databases (:ticket:`24817`).
* Fixed a crash when using a reverse one-to-one relation in
``ModelAdmin.list_display`` (:ticket:`24851`).
tests/admin_changelist/admin.py
Dosyayı görüntüle @
2456276b
...
@@ -102,7 +102,7 @@ site.register(Parent, NoListDisplayLinksParentAdmin)
...
@@ -102,7 +102,7 @@ site.register(Parent, NoListDisplayLinksParentAdmin)
class
SwallowAdmin
(
admin
.
ModelAdmin
):
class
SwallowAdmin
(
admin
.
ModelAdmin
):
actions
=
None
# prevent ['action_checkbox'] + list(list_display)
actions
=
None
# prevent ['action_checkbox'] + list(list_display)
list_display
=
(
'origin'
,
'load'
,
'speed'
)
list_display
=
(
'origin'
,
'load'
,
'speed'
,
'swallowonetoone'
)
site
.
register
(
Swallow
,
SwallowAdmin
)
site
.
register
(
Swallow
,
SwallowAdmin
)
...
...
tests/admin_changelist/models.py
Dosyayı görüntüle @
2456276b
...
@@ -78,6 +78,10 @@ class Swallow(models.Model):
...
@@ -78,6 +78,10 @@ class Swallow(models.Model):
ordering
=
(
'speed'
,
'load'
)
ordering
=
(
'speed'
,
'load'
)
class
SwallowOneToOne
(
models
.
Model
):
swallow
=
models
.
OneToOneField
(
Swallow
)
class
UnorderedObject
(
models
.
Model
):
class
UnorderedObject
(
models
.
Model
):
"""
"""
Model without any defined `Meta.ordering`.
Model without any defined `Meta.ordering`.
...
...
tests/admin_changelist/tests.py
Dosyayı görüntüle @
2456276b
...
@@ -25,7 +25,7 @@ from .admin import (
...
@@ -25,7 +25,7 @@ from .admin import (
from
.models
import
(
from
.models
import
(
Band
,
Child
,
ChordsBand
,
ChordsMusician
,
CustomIdUser
,
Event
,
Genre
,
Group
,
Band
,
Child
,
ChordsBand
,
ChordsMusician
,
CustomIdUser
,
Event
,
Genre
,
Group
,
Invitation
,
Membership
,
Musician
,
OrderedObject
,
Parent
,
Quartet
,
Swallow
,
Invitation
,
Membership
,
Musician
,
OrderedObject
,
Parent
,
Quartet
,
Swallow
,
UnorderedObject
,
SwallowOneToOne
,
UnorderedObject
,
)
)
...
@@ -478,8 +478,10 @@ class ChangeListTests(TestCase):
...
@@ -478,8 +478,10 @@ class ChangeListTests(TestCase):
Regression test for #17128
Regression test for #17128
(ChangeList failing under Python 2.5 after r16319)
(ChangeList failing under Python 2.5 after r16319)
"""
"""
swallow
=
Swallow
.
objects
.
create
(
swallow
=
Swallow
.
objects
.
create
(
origin
=
'Africa'
,
load
=
'12.34'
,
speed
=
'22.2'
)
origin
=
'Africa'
,
load
=
'12.34'
,
speed
=
'22.2'
)
swallow2
=
Swallow
.
objects
.
create
(
origin
=
'Africa'
,
load
=
'12.34'
,
speed
=
'22.2'
)
swallow_o2o
=
SwallowOneToOne
.
objects
.
create
(
swallow
=
swallow2
)
model_admin
=
SwallowAdmin
(
Swallow
,
admin
.
site
)
model_admin
=
SwallowAdmin
(
Swallow
,
admin
.
site
)
superuser
=
self
.
_create_superuser
(
'superuser'
)
superuser
=
self
.
_create_superuser
(
'superuser'
)
request
=
self
.
_mocked_authenticated_request
(
'/swallow/'
,
superuser
)
request
=
self
.
_mocked_authenticated_request
(
'/swallow/'
,
superuser
)
...
@@ -488,6 +490,9 @@ class ChangeListTests(TestCase):
...
@@ -488,6 +490,9 @@ class ChangeListTests(TestCase):
self
.
assertContains
(
response
,
six
.
text_type
(
swallow
.
origin
))
self
.
assertContains
(
response
,
six
.
text_type
(
swallow
.
origin
))
self
.
assertContains
(
response
,
six
.
text_type
(
swallow
.
load
))
self
.
assertContains
(
response
,
six
.
text_type
(
swallow
.
load
))
self
.
assertContains
(
response
,
six
.
text_type
(
swallow
.
speed
))
self
.
assertContains
(
response
,
six
.
text_type
(
swallow
.
speed
))
# Reverse one-to-one relations should work.
self
.
assertContains
(
response
,
'<td class="field-swallowonetoone">(None)</td>'
)
self
.
assertContains
(
response
,
'<td class="field-swallowonetoone">
%
s</td>'
%
swallow_o2o
)
def
test_deterministic_order_for_unordered_model
(
self
):
def
test_deterministic_order_for_unordered_model
(
self
):
"""
"""
...
...
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