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
901dc90d
Kaydet (Commit)
901dc90d
authored
Nis 15, 2016
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed unused/untested Field.get_choices_default()/value_to_string() methods.
üst
bb0b4b70
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
36 deletions
+1
-36
fields.py
django/contrib/contenttypes/fields.py
+0
-3
__init__.py
django/db/models/fields/__init__.py
+0
-3
related.py
django/db/models/fields/related.py
+1
-30
No files found.
django/contrib/contenttypes/fields.py
Dosyayı görüntüle @
901dc90d
...
@@ -401,9 +401,6 @@ class GenericRelation(ForeignObject):
...
@@ -401,9 +401,6 @@ class GenericRelation(ForeignObject):
from_opts
=
self
.
remote_field
.
model
.
_meta
from_opts
=
self
.
remote_field
.
model
.
_meta
return
[
PathInfo
(
from_opts
,
opts
,
(
opts
.
pk
,),
self
,
not
self
.
unique
,
False
)]
return
[
PathInfo
(
from_opts
,
opts
,
(
opts
.
pk
,),
self
,
not
self
.
unique
,
False
)]
def
get_choices_default
(
self
):
return
super
(
GenericRelation
,
self
)
.
get_choices
(
include_blank
=
False
)
def
value_to_string
(
self
,
obj
):
def
value_to_string
(
self
,
obj
):
qs
=
getattr
(
obj
,
self
.
name
)
.
all
()
qs
=
getattr
(
obj
,
self
.
name
)
.
all
()
return
smart_text
([
instance
.
_get_pk_val
()
for
instance
in
qs
])
return
smart_text
([
instance
.
_get_pk_val
()
for
instance
in
qs
])
...
...
django/db/models/fields/__init__.py
Dosyayı görüntüle @
901dc90d
...
@@ -855,9 +855,6 @@ class Field(RegisterLookupMixin):
...
@@ -855,9 +855,6 @@ class Field(RegisterLookupMixin):
limit_choices_to
)]
limit_choices_to
)]
return
first_choice
+
lst
return
first_choice
+
lst
def
get_choices_default
(
self
):
return
self
.
get_choices
()
@warn_about_renamed_method
(
@warn_about_renamed_method
(
'Field'
,
'_get_val_from_obj'
,
'value_from_object'
,
'Field'
,
'_get_val_from_obj'
,
'value_from_object'
,
RemovedInDjango20Warning
RemovedInDjango20Warning
...
...
django/db/models/fields/related.py
Dosyayı görüntüle @
901dc90d
...
@@ -14,7 +14,7 @@ from django.db.models.query_utils import PathInfo
...
@@ -14,7 +14,7 @@ from django.db.models.query_utils import PathInfo
from
django.db.models.utils
import
make_model_tuple
from
django.db.models.utils
import
make_model_tuple
from
django.utils
import
six
from
django.utils
import
six
from
django.utils.deprecation
import
RemovedInDjango20Warning
from
django.utils.deprecation
import
RemovedInDjango20Warning
from
django.utils.encoding
import
force_text
,
smart_text
from
django.utils.encoding
import
force_text
from
django.utils.functional
import
cached_property
,
curry
from
django.utils.functional
import
cached_property
,
curry
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.version
import
get_docs_version
from
django.utils.version
import
get_docs_version
...
@@ -911,18 +911,6 @@ class ForeignKey(ForeignObject):
...
@@ -911,18 +911,6 @@ class ForeignKey(ForeignObject):
def
get_db_prep_value
(
self
,
value
,
connection
,
prepared
=
False
):
def
get_db_prep_value
(
self
,
value
,
connection
,
prepared
=
False
):
return
self
.
target_field
.
get_db_prep_value
(
value
,
connection
,
prepared
)
return
self
.
target_field
.
get_db_prep_value
(
value
,
connection
,
prepared
)
def
value_to_string
(
self
,
obj
):
if
not
obj
:
# In required many-to-one fields with only one available choice,
# select that one available choice. Note: For SelectFields
# we have to check that the length of choices is *2*, not 1,
# because SelectFields always have an initial "blank" value.
if
not
self
.
blank
and
self
.
choices
:
choice_list
=
self
.
get_choices_default
()
if
len
(
choice_list
)
==
2
:
return
smart_text
(
choice_list
[
1
][
0
])
return
super
(
ForeignKey
,
self
)
.
value_to_string
(
obj
)
def
contribute_to_related_class
(
self
,
cls
,
related
):
def
contribute_to_related_class
(
self
,
cls
,
related
):
super
(
ForeignKey
,
self
)
.
contribute_to_related_class
(
cls
,
related
)
super
(
ForeignKey
,
self
)
.
contribute_to_related_class
(
cls
,
related
)
if
self
.
remote_field
.
field_name
is
None
:
if
self
.
remote_field
.
field_name
is
None
:
...
@@ -1455,9 +1443,6 @@ class ManyToManyField(RelatedField):
...
@@ -1455,9 +1443,6 @@ class ManyToManyField(RelatedField):
def
get_reverse_path_info
(
self
):
def
get_reverse_path_info
(
self
):
return
self
.
_get_path_info
(
direct
=
False
)
return
self
.
_get_path_info
(
direct
=
False
)
def
get_choices_default
(
self
):
return
Field
.
get_choices
(
self
,
include_blank
=
False
)
def
_get_m2m_db_table
(
self
,
opts
):
def
_get_m2m_db_table
(
self
,
opts
):
"""
"""
Function that can be curried to provide the m2m table name for this
Function that can be curried to provide the m2m table name for this
...
@@ -1518,20 +1503,6 @@ class ManyToManyField(RelatedField):
...
@@ -1518,20 +1503,6 @@ class ManyToManyField(RelatedField):
break
break
return
getattr
(
self
,
cache_attr
)
return
getattr
(
self
,
cache_attr
)
def
value_to_string
(
self
,
obj
):
data
=
''
if
obj
:
qs
=
getattr
(
obj
,
self
.
name
)
.
all
()
data
=
[
instance
.
_get_pk_val
()
for
instance
in
qs
]
else
:
# In required many-to-many fields with only one available choice,
# select that one available choice.
if
not
self
.
blank
:
choices_list
=
self
.
get_choices_default
()
if
len
(
choices_list
)
==
1
:
data
=
[
choices_list
[
0
][
0
]]
return
smart_text
(
data
)
def
contribute_to_class
(
self
,
cls
,
name
,
**
kwargs
):
def
contribute_to_class
(
self
,
cls
,
name
,
**
kwargs
):
# To support multiple relations to self, it's useful to have a non-None
# To support multiple relations to self, it's useful to have a non-None
# related name on symmetrical relations for internal reasons. The
# related name on symmetrical relations for internal reasons. The
...
...
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