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
a19f0d0c
Kaydet (Commit)
a19f0d0c
authored
Şub 26, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #22137 -- Made Widget.is_hidden a read-only property
Thanks django at patjack.co.uk for the report and the review.
üst
75d0dcbf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
6 deletions
+23
-6
widgets.py
django/contrib/admin/widgets.py
+4
-1
widgets.py
django/forms/widgets.py
+16
-5
1.7.txt
docs/releases/1.7.txt
+3
-0
No files found.
django/contrib/admin/widgets.py
Dosyayı görüntüle @
a19f0d0c
...
...
@@ -235,7 +235,6 @@ class RelatedFieldWidgetWrapper(forms.Widget):
admin interface.
"""
def
__init__
(
self
,
widget
,
rel
,
admin_site
,
can_add_related
=
None
):
self
.
is_hidden
=
widget
.
is_hidden
self
.
needs_multipart_form
=
widget
.
needs_multipart_form
self
.
attrs
=
widget
.
attrs
self
.
choices
=
widget
.
choices
...
...
@@ -256,6 +255,10 @@ class RelatedFieldWidgetWrapper(forms.Widget):
memo
[
id
(
self
)]
=
obj
return
obj
@property
def
is_hidden
(
self
):
return
self
.
widget
.
is_hidden
@property
def
media
(
self
):
return
self
.
widget
.
media
...
...
django/forms/widgets.py
Dosyayı görüntüle @
a19f0d0c
...
...
@@ -166,7 +166,6 @@ class SubWidget(object):
class
Widget
(
six
.
with_metaclass
(
MediaDefiningClass
)):
is_hidden
=
False
# Determines whether this corresponds to an <input type="hidden">.
needs_multipart_form
=
False
# Determines does this widget need multipart form
is_localized
=
False
is_required
=
False
...
...
@@ -183,6 +182,18 @@ class Widget(six.with_metaclass(MediaDefiningClass)):
memo
[
id
(
self
)]
=
obj
return
obj
@property
def
is_hidden
(
self
):
return
self
.
input_type
==
'hidden'
if
hasattr
(
self
,
'input_type'
)
else
False
@is_hidden.setter
def
is_hidden
(
self
,
*
args
):
warnings
.
warn
(
"`is_hidden` property is now read-only (and checks `input_type`). "
"Please update your code."
,
DeprecationWarning
,
stacklevel
=
2
)
def
subwidgets
(
self
,
name
,
value
,
attrs
=
None
,
choices
=
()):
"""
Yields all "subwidgets" of this widget. Used only by RadioSelect to
...
...
@@ -286,7 +297,6 @@ class PasswordInput(TextInput):
class
HiddenInput
(
Input
):
input_type
=
'hidden'
is_hidden
=
True
class
MultipleHiddenInput
(
HiddenInput
):
...
...
@@ -778,6 +788,10 @@ class MultiWidget(Widget):
self
.
widgets
=
[
w
()
if
isinstance
(
w
,
type
)
else
w
for
w
in
widgets
]
super
(
MultiWidget
,
self
)
.
__init__
(
attrs
)
@property
def
is_hidden
(
self
):
return
all
(
w
.
is_hidden
for
w
in
self
.
widgets
)
def
render
(
self
,
name
,
value
,
attrs
=
None
):
if
self
.
is_localized
:
for
widget
in
self
.
widgets
:
...
...
@@ -865,10 +879,7 @@ class SplitHiddenDateTimeWidget(SplitDateTimeWidget):
"""
A Widget that splits datetime input into two <input type="hidden"> inputs.
"""
is_hidden
=
True
def
__init__
(
self
,
attrs
=
None
,
date_format
=
None
,
time_format
=
None
):
super
(
SplitHiddenDateTimeWidget
,
self
)
.
__init__
(
attrs
,
date_format
,
time_format
)
for
widget
in
self
.
widgets
:
widget
.
input_type
=
'hidden'
widget
.
is_hidden
=
True
docs/releases/1.7.txt
Dosyayı görüntüle @
a19f0d0c
...
...
@@ -1100,6 +1100,9 @@ Miscellaneous
This widget now respects the form field's ``is_required`` attribute like
other widgets.
* ``Widget.is_hidden`` is now a read-only property, getting its value by
introspecting the presence of ``input_type == 'hidden'``.
* :meth:`~django.db.models.query.QuerySet.select_related` now chains in the
same way as other similar calls like ``prefetch_related``. That is,
``select_related('foo', 'bar')`` is equivalent to
...
...
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