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
c8dcded9
Kaydet (Commit)
c8dcded9
authored
Kas 29, 2014
tarafından
Berker Peksag
Kaydeden (comit)
Tim Graham
Kas 29, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #17890 -- Added an extra_context parameter to AdminSite.password_change().
üst
3131e9ce
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
2 deletions
+15
-2
sites.py
django/contrib/admin/sites.py
+2
-2
1.8.txt
docs/releases/1.8.txt
+3
-0
customadmin.py
tests/admin_views/customadmin.py
+3
-0
tests.py
tests/admin_views/tests.py
+6
-0
password_change_form.html
tests/templates/custom_admin/password_change_form.html
+1
-0
No files found.
django/contrib/admin/sites.py
Dosyayı görüntüle @
c8dcded9
...
@@ -281,7 +281,7 @@ class AdminSite(object):
...
@@ -281,7 +281,7 @@ class AdminSite(object):
'site_url'
:
self
.
site_url
,
'site_url'
:
self
.
site_url
,
}
}
def
password_change
(
self
,
request
):
def
password_change
(
self
,
request
,
extra_context
=
None
):
"""
"""
Handles the "change password" task -- both form display and validation.
Handles the "change password" task -- both form display and validation.
"""
"""
...
@@ -292,7 +292,7 @@ class AdminSite(object):
...
@@ -292,7 +292,7 @@ class AdminSite(object):
'current_app'
:
self
.
name
,
'current_app'
:
self
.
name
,
'password_change_form'
:
AdminPasswordChangeForm
,
'password_change_form'
:
AdminPasswordChangeForm
,
'post_change_redirect'
:
url
,
'post_change_redirect'
:
url
,
'extra_context'
:
self
.
each_context
(
),
'extra_context'
:
dict
(
self
.
each_context
(),
**
(
extra_context
or
{})
),
}
}
if
self
.
password_change_template
is
not
None
:
if
self
.
password_change_template
is
not
None
:
defaults
[
'template_name'
]
=
self
.
password_change_template
defaults
[
'template_name'
]
=
self
.
password_change_template
...
...
docs/releases/1.8.txt
Dosyayı görüntüle @
c8dcded9
...
@@ -100,6 +100,9 @@ Minor features
...
@@ -100,6 +100,9 @@ Minor features
<django.contrib.admin.ModelAdmin.show_full_result_count>` to control whether
<django.contrib.admin.ModelAdmin.show_full_result_count>` to control whether
or not the full count of objects should be displayed on a filtered admin page.
or not the full count of objects should be displayed on a filtered admin page.
* The ``AdminSite.password_change()`` method now has an ``extra_context``
parameter.
:mod:`django.contrib.admindocs`
:mod:`django.contrib.admindocs`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
...
tests/admin_views/customadmin.py
Dosyayı görüntüle @
c8dcded9
...
@@ -33,6 +33,9 @@ class Admin2(admin.AdminSite):
...
@@ -33,6 +33,9 @@ class Admin2(admin.AdminSite):
def
my_view
(
self
,
request
):
def
my_view
(
self
,
request
):
return
HttpResponse
(
"Django is a magical pony!"
)
return
HttpResponse
(
"Django is a magical pony!"
)
def
password_change
(
self
,
request
,
extra_context
=
None
):
return
super
(
Admin2
,
self
)
.
password_change
(
request
,
{
'spam'
:
'eggs'
})
class
UserLimitedAdmin
(
UserAdmin
):
class
UserLimitedAdmin
(
UserAdmin
):
# used for testing password change on a user not in queryset
# used for testing password change on a user not in queryset
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
c8dcded9
...
@@ -1012,6 +1012,12 @@ class CustomModelAdminTest(AdminViewBasicTestCase):
...
@@ -1012,6 +1012,12 @@ class CustomModelAdminTest(AdminViewBasicTestCase):
self
.
assertTemplateUsed
(
response
,
'custom_admin/password_change_form.html'
)
self
.
assertTemplateUsed
(
response
,
'custom_admin/password_change_form.html'
)
self
.
assertContains
(
response
,
'Hello from a custom password change form template'
)
self
.
assertContains
(
response
,
'Hello from a custom password change form template'
)
def
test_custom_admin_site_password_change_with_extra_context
(
self
):
response
=
self
.
client
.
get
(
'/test_admin/admin2/password_change/'
)
self
.
assertIsInstance
(
response
,
TemplateResponse
)
self
.
assertTemplateUsed
(
response
,
'custom_admin/password_change_form.html'
)
self
.
assertContains
(
response
,
'eggs'
)
def
test_custom_admin_site_password_change_done_template
(
self
):
def
test_custom_admin_site_password_change_done_template
(
self
):
response
=
self
.
client
.
get
(
'/test_admin/admin2/password_change/done/'
)
response
=
self
.
client
.
get
(
'/test_admin/admin2/password_change/done/'
)
self
.
assertIsInstance
(
response
,
TemplateResponse
)
self
.
assertIsInstance
(
response
,
TemplateResponse
)
...
...
tests/templates/custom_admin/password_change_form.html
Dosyayı görüntüle @
c8dcded9
{% extends "registration/password_change_form.html" %}
{% extends "registration/password_change_form.html" %}
{% block content %}
{% block content %}
{{ spam }}
Hello from a custom password change form template
Hello from a custom password change form template
{{ block.super }}
{{ block.super }}
{% endblock %}
{% endblock %}
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