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
8ea541e6
Kaydet (Commit)
8ea541e6
authored
Ock 04, 2017
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #2856 -- Removed redundant escaping in admin's "Perhaps it was deleted?" message.
üst
bff4abac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
options.py
django/contrib/admin/options.py
+3
-3
tests.py
tests/admin_views/tests.py
+6
-6
No files found.
django/contrib/admin/options.py
Dosyayı görüntüle @
8ea541e6
...
...
@@ -41,7 +41,7 @@ from django.urls import reverse
from
django.utils
import
six
from
django.utils.decorators
import
method_decorator
from
django.utils.encoding
import
force_text
,
python_2_unicode_compatible
from
django.utils.html
import
escape
,
format_html
from
django.utils.html
import
format_html
from
django.utils.http
import
urlencode
,
urlquote
from
django.utils.safestring
import
mark_safe
from
django.utils.text
import
capfirst
,
format_lazy
,
get_text_list
...
...
@@ -1394,9 +1394,9 @@ class ModelAdmin(BaseModelAdmin):
Create a message informing the user that the object doesn't exist
and return a redirect to the admin index page.
"""
msg
=
_
(
"
%(name)
s with ID
%(key)
s doesn't exist. Perhaps it was deleted?
"
)
%
{
msg
=
_
(
"
""
%(name)
s with ID "
%(key)
s" doesn't exist. Perhaps it was deleted?""
"
)
%
{
'name'
:
force_text
(
opts
.
verbose_name
),
'key'
:
escap
e
(
object_id
),
'key'
:
unquot
e
(
object_id
),
}
self
.
message_user
(
request
,
msg
,
messages
.
WARNING
)
url
=
reverse
(
'admin:index'
,
current_app
=
self
.
admin_site
.
name
)
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
8ea541e6
...
...
@@ -249,11 +249,11 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
model with an integer PK field) redirects to the index page with a
message saying the object doesn't exist.
"""
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_section_change'
,
args
=
(
'abc'
,)),
follow
=
True
)
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_section_change'
,
args
=
(
quote
(
"abc/<b>"
)
,)),
follow
=
True
)
self
.
assertRedirects
(
response
,
reverse
(
'admin:index'
))
self
.
assertEqual
(
[
m
.
message
for
m
in
response
.
context
[
'messages'
]],
[
"
section with ID abc doesn't exist. Perhaps it was deleted?
"
]
[
"
""section with ID "abc/<b>" doesn't exist. Perhaps it was deleted?""
"
]
)
def
test_basic_edit_GET_old_url_redirect
(
self
):
...
...
@@ -274,7 +274,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
self
.
assertRedirects
(
response
,
reverse
(
'admin:index'
))
self
.
assertEqual
(
[
m
.
message
for
m
in
response
.
context
[
'messages'
]],
[
"
super villain with ID abc doesn't exist. Perhaps it was deleted?
"
]
[
"
""super villain with ID "abc" doesn't exist. Perhaps it was deleted?""
"
]
)
def
test_basic_add_POST
(
self
):
...
...
@@ -1801,7 +1801,7 @@ class AdminViewPermissionsTest(TestCase):
self
.
assertRedirects
(
response
,
reverse
(
'admin:index'
))
self
.
assertEqual
(
[
m
.
message
for
m
in
response
.
context
[
'messages'
]],
[
"
article with ID nonexistent doesn't exist. Perhaps it was deleted?
"
]
[
"
""article with ID "nonexistent" doesn't exist. Perhaps it was deleted?""
"
]
)
def
test_history_view
(
self
):
...
...
@@ -1849,7 +1849,7 @@ class AdminViewPermissionsTest(TestCase):
self
.
assertRedirects
(
response
,
reverse
(
'admin:index'
))
self
.
assertEqual
(
[
m
.
message
for
m
in
response
.
context
[
'messages'
]],
[
"
article with ID foo doesn't exist. Perhaps it was deleted?
"
]
[
"
""article with ID "foo" doesn't exist. Perhaps it was deleted?""
"
]
)
def
test_conditionally_show_add_section_link
(
self
):
...
...
@@ -3638,7 +3638,7 @@ class AdminCustomQuerysetTest(TestCase):
self
.
assertRedirects
(
response
,
reverse
(
'admin:index'
))
self
.
assertEqual
(
[
m
.
message
for
m
in
response
.
context
[
'messages'
]],
[
"
empty model with ID 1 doesn't exist. Perhaps it was deleted?
"
]
[
"
""empty model with ID "1" doesn't exist. Perhaps it was deleted?""
"
]
)
def
test_add_model_modeladmin_defer_qs
(
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