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
27641465
Kaydet (Commit)
27641465
authored
Haz 15, 2014
tarafından
Marc Tamlyn
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #22838 -- Deprecated ModelChoiceField.cache_choices.
Undocumented, untested and probably not even useful feature.
üst
97adfc2b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
models.py
django/forms/models.py
+10
-2
deprecation.txt
docs/internals/deprecation.txt
+3
-0
1.8.txt
docs/releases/1.8.txt
+9
-0
No files found.
django/forms/models.py
Dosyayı görüntüle @
27641465
...
@@ -6,6 +6,7 @@ and database field objects.
...
@@ -6,6 +6,7 @@ and database field objects.
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
collections
import
OrderedDict
from
collections
import
OrderedDict
import
warnings
from
django.core.exceptions
import
(
from
django.core.exceptions
import
(
ImproperlyConfigured
,
ValidationError
,
NON_FIELD_ERRORS
,
FieldError
)
ImproperlyConfigured
,
ValidationError
,
NON_FIELD_ERRORS
,
FieldError
)
...
@@ -16,6 +17,7 @@ from django.forms.utils import ErrorList
...
@@ -16,6 +17,7 @@ from django.forms.utils import ErrorList
from
django.forms.widgets
import
(
SelectMultiple
,
HiddenInput
,
from
django.forms.widgets
import
(
SelectMultiple
,
HiddenInput
,
MultipleHiddenInput
)
MultipleHiddenInput
)
from
django.utils
import
six
from
django.utils
import
six
from
django.utils.deprecation
import
RemovedInDjango19Warning
from
django.utils.encoding
import
smart_text
,
force_text
from
django.utils.encoding
import
smart_text
,
force_text
from
django.utils.text
import
get_text_list
,
capfirst
from
django.utils.text
import
get_text_list
,
capfirst
from
django.utils.translation
import
ugettext_lazy
as
_
,
ugettext
from
django.utils.translation
import
ugettext_lazy
as
_
,
ugettext
...
@@ -1092,7 +1094,7 @@ class ModelChoiceField(ChoiceField):
...
@@ -1092,7 +1094,7 @@ class ModelChoiceField(ChoiceField):
' the available choices.'
),
' the available choices.'
),
}
}
def
__init__
(
self
,
queryset
,
empty_label
=
"---------"
,
cache_choices
=
Fals
e
,
def
__init__
(
self
,
queryset
,
empty_label
=
"---------"
,
cache_choices
=
Non
e
,
required
=
True
,
widget
=
None
,
label
=
None
,
initial
=
None
,
required
=
True
,
widget
=
None
,
label
=
None
,
initial
=
None
,
help_text
=
''
,
to_field_name
=
None
,
limit_choices_to
=
None
,
help_text
=
''
,
to_field_name
=
None
,
limit_choices_to
=
None
,
*
args
,
**
kwargs
):
*
args
,
**
kwargs
):
...
@@ -1100,6 +1102,12 @@ class ModelChoiceField(ChoiceField):
...
@@ -1100,6 +1102,12 @@ class ModelChoiceField(ChoiceField):
self
.
empty_label
=
None
self
.
empty_label
=
None
else
:
else
:
self
.
empty_label
=
empty_label
self
.
empty_label
=
empty_label
if
cache_choices
is
not
None
:
warnings
.
warn
(
"cache_choices has been deprecated and will be "
"removed in Django 1.9."
,
RemovedInDjango19Warning
,
stacklevel
=
2
)
else
:
cache_choices
=
False
self
.
cache_choices
=
cache_choices
self
.
cache_choices
=
cache_choices
# Call Field instead of ChoiceField __init__() because we don't need
# Call Field instead of ChoiceField __init__() because we don't need
...
@@ -1191,7 +1199,7 @@ class ModelMultipleChoiceField(ModelChoiceField):
...
@@ -1191,7 +1199,7 @@ class ModelMultipleChoiceField(ModelChoiceField):
'invalid_pk_value'
:
_
(
'"
%(pk)
s" is not a valid value for a primary key.'
)
'invalid_pk_value'
:
_
(
'"
%(pk)
s" is not a valid value for a primary key.'
)
}
}
def
__init__
(
self
,
queryset
,
cache_choices
=
Fals
e
,
required
=
True
,
def
__init__
(
self
,
queryset
,
cache_choices
=
Non
e
,
required
=
True
,
widget
=
None
,
label
=
None
,
initial
=
None
,
widget
=
None
,
label
=
None
,
initial
=
None
,
help_text
=
''
,
*
args
,
**
kwargs
):
help_text
=
''
,
*
args
,
**
kwargs
):
super
(
ModelMultipleChoiceField
,
self
)
.
__init__
(
queryset
,
None
,
super
(
ModelMultipleChoiceField
,
self
)
.
__init__
(
queryset
,
None
,
...
...
docs/internals/deprecation.txt
Dosyayı görüntüle @
27641465
...
@@ -154,6 +154,9 @@ details on these changes.
...
@@ -154,6 +154,9 @@ details on these changes.
* Database test settings as independent entries in the database settings,
* Database test settings as independent entries in the database settings,
prefixed by ``TEST_``, will no longer be supported.
prefixed by ``TEST_``, will no longer be supported.
* The `cache_choices` option to :class:`~django.forms.ModelChoiceField` and
:class:`~django.forms.MultipleModelChoiceField` will be removed.
.. _deprecation-removed-in-1.8:
.. _deprecation-removed-in-1.8:
1.8
1.8
...
...
docs/releases/1.8.txt
Dosyayı görüntüle @
27641465
...
@@ -479,3 +479,12 @@ arguments through ``argparse.add_argument()``. See
...
@@ -479,3 +479,12 @@ arguments through ``argparse.add_argument()``. See
The class :class:`~django.core.management.NoArgsCommand` is now deprecated and
The class :class:`~django.core.management.NoArgsCommand` is now deprecated and
will be removed in Django 2.0. Use :class:`~django.core.management.BaseCommand`
will be removed in Django 2.0. Use :class:`~django.core.management.BaseCommand`
instead, which takes no arguments by default.
instead, which takes no arguments by default.
``cache_choices`` option of ``ModelChoiceField`` and ``MultipleModelChoiceField``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:class:`~django.forms.ModelChoiceField` and
:class:`~django.forms.MultipleModelChoiceField` took an undocumented, untested
option ``cache_choices``. This cached querysets between multiple renderings of
the same ``Form`` object. This option is subject to an accelerated deprecation
and will be removed in Django 1.9.
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