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
1b47508a
Kaydet (Commit)
1b47508a
authored
Agu 01, 2013
tarafından
Petr Dlouhý
Kaydeden (comit)
Tim Graham
Agu 02, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed LogEntry.get_admin_url() for non-existent models.
Regression introduced by [
369b6fab
]; refs #18169.
üst
a0ed2f92
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
models.py
django/contrib/admin/models.py
+5
-2
tests.py
tests/admin_views/tests.py
+11
-0
No files found.
django/contrib/admin/models.py
Dosyayı görüntüle @
1b47508a
...
...
@@ -4,7 +4,7 @@ from django.db import models
from
django.conf
import
settings
from
django.contrib.contenttypes.models
import
ContentType
from
django.contrib.admin.util
import
quote
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
,
NoReverseMatch
from
django.utils.translation
import
ugettext
,
ugettext_lazy
as
_
from
django.utils.encoding
import
smart_text
from
django.utils.encoding
import
python_2_unicode_compatible
...
...
@@ -74,5 +74,8 @@ class LogEntry(models.Model):
"""
if
self
.
content_type
and
self
.
object_id
:
url_name
=
'admin:
%
s_
%
s_change'
%
(
self
.
content_type
.
app_label
,
self
.
content_type
.
model
)
return
reverse
(
url_name
,
args
=
(
quote
(
self
.
object_id
),))
try
:
return
reverse
(
url_name
,
args
=
(
quote
(
self
.
object_id
),))
except
NoReverseMatch
:
pass
return
None
tests/admin_views/tests.py
Dosyayı görüntüle @
1b47508a
...
...
@@ -1533,6 +1533,17 @@ class AdminViewStringPrimaryKeyTest(TestCase):
self
.
assertEqual
(
counted_presence_before
-
1
,
counted_presence_after
)
def
test_logentry_get_admin_url
(
self
):
"LogEntry.get_admin_url returns a URL to edit the entry's object or None for non-existent (possibly deleted) models"
log_entry_name
=
"Model with string primary key"
# capitalized in Recent Actions
logentry
=
LogEntry
.
objects
.
get
(
content_type__name__iexact
=
log_entry_name
)
model
=
"modelwithstringprimarykey"
desired_admin_url
=
"/test_admin/admin/admin_views/
%
s/
%
s/"
%
(
model
,
escape
(
iri_to_uri
(
urlquote
(
quote
(
self
.
pk
)))))
self
.
assertEqual
(
logentry
.
get_admin_url
(),
desired_admin_url
)
logentry
.
content_type
.
model
=
"non-existent"
self
.
assertEqual
(
logentry
.
get_admin_url
(),
None
)
def
test_deleteconfirmation_link
(
self
):
"The link from the delete confirmation page referring back to the changeform of the object should be quoted"
response
=
self
.
client
.
get
(
'/test_admin/admin/admin_views/modelwithstringprimarykey/
%
s/delete/'
%
quote
(
self
.
pk
))
...
...
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