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
7140d4ad
Kaydet (Commit)
7140d4ad
authored
Eyl 01, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #23444 -- Removed InlineAdminForm.original_content_type_id per deprecation timeline.
üst
1bb6ecf6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
43 deletions
+1
-43
helpers.py
django/contrib/admin/helpers.py
+1
-19
tests.py
tests/admin_inlines/tests.py
+0
-24
No files found.
django/contrib/admin/helpers.py
Dosyayı görüntüle @
7140d4ad
...
...
@@ -14,11 +14,8 @@ from django.db.models.fields.related import ManyToManyRel
from
django.forms.utils
import
flatatt
from
django.template.defaultfilters
import
capfirst
,
linebreaksbr
from
django.utils
import
six
from
django.utils.deprecation
import
(
RemovedInDjango20Warning
,
RemovedInDjango110Warning
,
)
from
django.utils.deprecation
import
RemovedInDjango20Warning
from
django.utils.encoding
import
force_text
,
smart_text
from
django.utils.functional
import
cached_property
from
django.utils.html
import
conditional_escape
,
format_html
from
django.utils.safestring
import
mark_safe
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
@@ -292,21 +289,6 @@ class InlineAdminForm(AdminForm):
super
(
InlineAdminForm
,
self
)
.
__init__
(
form
,
fieldsets
,
prepopulated_fields
,
readonly_fields
,
model_admin
)
@cached_property
def
original_content_type_id
(
self
):
warnings
.
warn
(
'InlineAdminForm.original_content_type_id is deprecated and will be '
'removed in Django 1.10. If you were using this attribute to construct '
'the "view on site" URL, use the `absolute_url` attribute instead.'
,
RemovedInDjango110Warning
,
stacklevel
=
2
)
if
self
.
original
is
not
None
:
# Since this module gets imported in the application's root package,
# it cannot import models from other applications at the module level.
from
django.contrib.contenttypes.models
import
ContentType
return
ContentType
.
objects
.
get_for_model
(
self
.
original
)
.
pk
raise
AttributeError
def
__iter__
(
self
):
for
name
,
options
in
self
.
fieldsets
:
yield
InlineFieldset
(
self
.
formset
,
self
.
form
,
name
,
...
...
tests/admin_inlines/tests.py
Dosyayı görüntüle @
7140d4ad
from
__future__
import
unicode_literals
import
datetime
import
warnings
from
django.contrib.admin
import
ModelAdmin
,
TabularInline
from
django.contrib.admin.helpers
import
InlineAdminForm
...
...
@@ -10,7 +9,6 @@ from django.contrib.auth.models import Permission, User
from
django.contrib.contenttypes.models
import
ContentType
from
django.core.urlresolvers
import
reverse
from
django.test
import
RequestFactory
,
TestCase
,
override_settings
from
django.utils.encoding
import
force_text
from
.admin
import
InnerInline
,
site
as
admin_site
from
.models
import
(
...
...
@@ -458,28 +456,6 @@ class TestInlineAdminForm(TestCase):
parent_ct
=
ContentType
.
objects
.
get_for_model
(
Parent
)
self
.
assertEqual
(
iaf
.
original
.
content_type
,
parent_ct
)
def
test_original_content_type_id_deprecated
(
self
):
"""
#23444 -- Verify a warning is raised when accessing
`original_content_type_id` attribute of `InlineAdminForm` object.
"""
iaf
=
InlineAdminForm
(
None
,
None
,
{},
{},
None
)
poll
=
Poll
.
objects
.
create
(
name
=
"poll"
)
iaf2
=
InlineAdminForm
(
None
,
None
,
{},
{},
poll
)
poll_ct
=
ContentType
.
objects
.
get_for_model
(
Poll
)
with
warnings
.
catch_warnings
(
record
=
True
)
as
recorded
:
warnings
.
filterwarnings
(
'always'
)
with
self
.
assertRaises
(
AttributeError
):
iaf
.
original_content_type_id
msg
=
force_text
(
recorded
.
pop
()
.
message
)
self
.
assertEqual
(
msg
,
'InlineAdminForm.original_content_type_id is deprecated and will be '
'removed in Django 1.10. If you were using this attribute to construct '
'the "view on site" URL, use the `absolute_url` attribute instead.'
)
self
.
assertEqual
(
iaf2
.
original_content_type_id
,
poll_ct
.
id
)
@override_settings
(
PASSWORD_HASHERS
=
[
'django.contrib.auth.hashers.SHA1PasswordHasher'
],
ROOT_URLCONF
=
"admin_inlines.urls"
)
...
...
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