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
f819bef3
Kaydet (Commit)
f819bef3
authored
Şub 26, 2013
tarafından
Javier Mansilla
Kaydeden (comit)
Tim Graham
Haz 25, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #19773 - Added admin/popup_response.html template.
Thanks jimmylam@ for the suggestion.
üst
e10757ff
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
8 deletions
+27
-8
options.py
django/contrib/admin/options.py
+5
-6
popup_response.html
django/contrib/admin/templates/admin/popup_response.html
+9
-0
models.py
tests/admin_views/models.py
+1
-1
tests.py
tests/admin_views/tests.py
+12
-1
No files found.
django/contrib/admin/options.py
Dosyayı görüntüle @
f819bef3
...
...
@@ -24,7 +24,7 @@ from django.db.models.constants import LOOKUP_SEP
from
django.db.models.related
import
RelatedObject
from
django.db.models.fields
import
BLANK_CHOICE_DASH
,
FieldDoesNotExist
from
django.db.models.sql.constants
import
QUERY_TERMS
from
django.http
import
Http404
,
HttpResponse
,
HttpResponse
Redirect
from
django.http
import
Http404
,
HttpResponseRedirect
from
django.http.response
import
HttpResponseBase
from
django.shortcuts
import
get_object_or_404
from
django.template.response
import
SimpleTemplateResponse
,
TemplateResponse
...
...
@@ -911,11 +911,10 @@ class ModelAdmin(BaseModelAdmin):
# Here, we distinguish between different save types by checking for
# the presence of keys in request.POST.
if
IS_POPUP_VAR
in
request
.
POST
:
return
HttpResponse
(
'<!DOCTYPE html><html><head><title></title></head><body>'
'<script type="text/javascript">opener.dismissAddAnotherPopup(window, "
%
s", "
%
s");</script></body></html>'
%
\
# escape() calls force_text.
(
escape
(
pk_value
),
escapejs
(
obj
)))
return
SimpleTemplateResponse
(
'admin/popup_response.html'
,
{
'pk_value'
:
escape
(
pk_value
),
'obj'
:
escapejs
(
obj
)
})
elif
"_continue"
in
request
.
POST
:
msg
=
_
(
'The
%(name)
s "
%(obj)
s" was added successfully. You may edit it again below.'
)
%
msg_dict
...
...
django/contrib/admin/templates/admin/popup_response.html
0 → 100644
Dosyayı görüntüle @
f819bef3
<!DOCTYPE html>
<html>
<head><title></title></head>
<body>
<script
type=
"text/javascript"
>
opener
.
dismissAddAnotherPopup
(
window
,
"{{ pk_value }}"
,
"{{ obj }}"
);
</script>
</body>
</html>
tests/admin_views/models.py
Dosyayı görüntüle @
f819bef3
...
...
@@ -137,7 +137,7 @@ class Thing(models.Model):
class
Actor
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
age
=
models
.
IntegerField
()
title
=
models
.
CharField
(
max_length
=
50
,
null
=
True
)
title
=
models
.
CharField
(
max_length
=
50
,
null
=
True
,
blank
=
True
)
def
__str__
(
self
):
return
self
.
name
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
f819bef3
...
...
@@ -2554,6 +2554,17 @@ action)</option>
'/test_admin/admin/admin_views/subscriber/?
%
s'
%
IS_POPUP_VAR
)
self
.
assertEqual
(
response
.
context
[
"action_form"
],
None
)
def
test_popup_template_response
(
self
):
"""
Success on popups shall be rendered from template in order to allow
easy customization.
"""
response
=
self
.
client
.
post
(
'/test_admin/admin/admin_views/actor/add/?
%
s=1'
%
IS_POPUP_VAR
,
{
'name'
:
'Troy McClure'
,
'age'
:
'55'
,
IS_POPUP_VAR
:
'1'
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
template_name
,
'admin/popup_response.html'
)
@override_settings
(
PASSWORD_HASHERS
=
(
'django.contrib.auth.hashers.SHA1PasswordHasher'
,))
class
TestCustomChangeList
(
TestCase
):
...
...
@@ -4275,7 +4286,7 @@ class AdminKeepChangeListFiltersTests(TestCase):
# Get the `add_view`.
response
=
self
.
client
.
get
(
self
.
get_add_url
())
self
.
assertEqual
(
response
.
status_code
,
200
)
# Check the form action.
form_action
=
"""<form enctype="multipart/form-data" action="?
%
s" method="post" id="user_form">"""
%
self
.
get_preserved_filters_querystring
()
self
.
assertContains
(
response
,
form_action
,
count
=
1
)
...
...
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