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
b3162cab
Kaydet (Commit)
b3162cab
authored
Kas 05, 2016
tarafından
Jacob Rief
Kaydeden (comit)
Tim Graham
Kas 12, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27386 -- Wrapped admin's readonly fields in <div> rather than <p>.
üst
a17fe73d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
12 deletions
+24
-12
forms.css
django/contrib/admin/static/admin/css/forms.css
+1
-1
fieldset.html
django/contrib/admin/templates/admin/includes/fieldset.html
+1
-1
1.11.txt
docs/releases/1.11.txt
+9
-0
tests.py
tests/admin_views/tests.py
+10
-7
tests.py
tests/admin_widgets/tests.py
+3
-3
No files found.
django/contrib/admin/static/admin/css/forms.css
Dosyayı görüntüle @
b3162cab
...
...
@@ -83,7 +83,7 @@ form ul.inline li {
height
:
26px
;
}
.aligned
label
+
p
,
.aligned
label
+
div
.help
{
.aligned
label
+
p
,
.aligned
label
+
div
.help
,
.aligned
label
+
div
.readonly
{
padding
:
6px
0
;
margin-top
:
0
;
margin-bottom
:
0
;
...
...
django/contrib/admin/templates/admin/includes/fieldset.html
Dosyayı görüntüle @
b3162cab
...
...
@@ -14,7 +14,7 @@
{% else %}
{{ field.label_tag }}
{% if field.is_readonly %}
<
p>
{{ field.contents }}
</p
>
<
div
class=
"readonly"
>
{{ field.contents }}
</div
>
{% else %}
{{ field.field }}
{% endif %}
...
...
docs/releases/1.11.txt
Dosyayı görüntüle @
b3162cab
...
...
@@ -501,6 +501,15 @@ This works similar to ``settings.TIME_ZONE = None`` except that it also sets
if there's a use case where you find you can't adapt your code to set a
``TIME_ZONE``.
HTML changes in admin templates
-------------------------------
``<p class="help">`` is replaced with a ``<div>`` tag to allow including lists
inside help text.
Read-only fields are wrapped in ``<div class="readonly">...</div>`` instead of
``<p>...</p>`` to allow any kind of HTML as the field's content.
Miscellaneous
-------------
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
b3162cab
...
...
@@ -4598,11 +4598,15 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
self
.
assertContains
(
response
,
"foo"
)
# Multiline text in a readonly field gets <br /> tags
self
.
assertContains
(
response
,
"Multiline<br />test<br />string"
)
self
.
assertContains
(
response
,
"<p>Multiline<br />html<br />content</p>"
,
html
=
True
)
self
.
assertContains
(
response
,
"InlineMultiline<br />test<br />string"
)
self
.
assertContains
(
response
,
'Multiline<br />test<br />string'
)
self
.
assertContains
(
response
,
'<div class="readonly">Multiline<br />html<br />content</div>'
,
html
=
True
)
self
.
assertContains
(
response
,
'InlineMultiline<br />test<br />string'
)
# Remove only this last line when the deprecation completes.
self
.
assertContains
(
response
,
"<p>Multiline<br />html<br />content<br />with allow tags</p>"
,
html
=
True
)
self
.
assertContains
(
response
,
'<div class="readonly">Multiline<br />html<br />content<br />with allow tags</div>'
,
html
=
True
)
self
.
assertContains
(
response
,
formats
.
localize
(
datetime
.
date
.
today
()
-
datetime
.
timedelta
(
days
=
7
)))
...
...
@@ -4685,8 +4689,7 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
"""
choice
=
Choice
.
objects
.
create
(
choice
=
None
)
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_choice_change'
,
args
=
(
choice
.
pk
,)))
self
.
assertContains
(
response
,
'<p>No opinion</p>'
,
html
=
True
)
self
.
assertNotContains
(
response
,
'<p>(None)</p>'
)
self
.
assertContains
(
response
,
'<div class="readonly">No opinion</div>'
,
html
=
True
)
def
test_readonly_manytomany_backwards_ref
(
self
):
"""
...
...
@@ -4705,7 +4708,7 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
pizza
.
toppings
.
add
(
topping
)
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_pizza_change'
,
args
=
(
pizza
.
pk
,)))
self
.
assertContains
(
response
,
'<label>Toppings:</label>'
,
html
=
True
)
self
.
assertContains
(
response
,
'<
p>Salami</p
>'
,
html
=
True
)
self
.
assertContains
(
response
,
'<
div class="readonly">Salami</div
>'
,
html
=
True
)
def
test_readonly_onetoone_backwards_ref
(
self
):
"""
...
...
tests/admin_widgets/tests.py
Dosyayı görüntüle @
b3162cab
...
...
@@ -419,8 +419,8 @@ class AdminFileWidgetTests(TestDataMixin, TestCase):
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_widgets_album_change'
,
args
=
(
self
.
album
.
id
,)))
self
.
assertContains
(
response
,
'<
p
><a href="
%(STORAGE_URL)
salbums/hybrid_theory.jpg">'
r'albums\hybrid_theory.jpg</a></
p
>'
%
{
'STORAGE_URL'
:
default_storage
.
url
(
''
)},
'<
div class="readonly"
><a href="
%(STORAGE_URL)
salbums/hybrid_theory.jpg">'
r'albums\hybrid_theory.jpg</a></
div
>'
%
{
'STORAGE_URL'
:
default_storage
.
url
(
''
)},
html
=
True
,
)
self
.
assertNotContains
(
...
...
@@ -431,7 +431,7 @@ class AdminFileWidgetTests(TestDataMixin, TestCase):
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_widgets_album_add'
))
self
.
assertContains
(
response
,
'<
p></p
>'
,
'<
div class="readonly"></div
>'
,
html
=
True
,
)
...
...
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