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
621c25c4
Kaydet (Commit)
621c25c4
authored
Ara 06, 2013
tarafından
Baptiste Mispelon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added missing deconstruct() methods.
üst
72479a29
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
4 deletions
+25
-4
__init__.py
django/db/models/__init__.py
+1
-0
__init__.py
django/db/models/fields/__init__.py
+2
-0
proxy.py
django/db/models/fields/proxy.py
+5
-0
related.py
django/db/models/fields/related.py
+12
-4
models.py
tests/serializers/models.py
+5
-0
No files found.
django/db/models/__init__.py
Dosyayı görüntüle @
621c25c4
...
...
@@ -15,6 +15,7 @@ from django.db.models.fields.files import FileField, ImageField # NOQA
from
django.db.models.fields.related
import
(
# NOQA
ForeignKey
,
ForeignObject
,
OneToOneField
,
ManyToManyField
,
ManyToOneRel
,
ManyToManyRel
,
OneToOneRel
)
from
django.db.models.fields.proxy
import
OrderWrt
from
django.db.models.deletion
import
(
# NOQA
CASCADE
,
PROTECT
,
SET
,
SET_NULL
,
SET_DEFAULT
,
DO_NOTHING
,
ProtectedError
)
from
django.db.models
import
signals
# NOQA
...
...
django/db/models/fields/__init__.py
Dosyayı görüntüle @
621c25c4
...
...
@@ -230,6 +230,8 @@ class Field(object):
path
=
path
.
replace
(
"django.db.models.fields.related"
,
"django.db.models"
)
if
path
.
startswith
(
"django.db.models.fields.files"
):
path
=
path
.
replace
(
"django.db.models.fields.files"
,
"django.db.models"
)
if
path
.
startswith
(
"django.db.models.fields.proxy"
):
path
=
path
.
replace
(
"django.db.models.fields.proxy"
,
"django.db.models"
)
if
path
.
startswith
(
"django.db.models.fields"
):
path
=
path
.
replace
(
"django.db.models.fields"
,
"django.db.models"
)
# Return basic info - other fields should override this.
...
...
django/db/models/fields/proxy.py
Dosyayı görüntüle @
621c25c4
...
...
@@ -16,3 +16,8 @@ class OrderWrt(fields.IntegerField):
kwargs
[
'name'
]
=
'_order'
kwargs
[
'editable'
]
=
False
super
(
OrderWrt
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
def
deconstruct
(
self
):
name
,
path
,
args
,
kwargs
=
super
(
OrderWrt
,
self
)
.
deconstruct
()
del
kwargs
[
'editable'
]
return
name
,
path
,
args
,
kwargs
django/db/models/fields/related.py
Dosyayı görüntüle @
621c25c4
...
...
@@ -1019,6 +1019,16 @@ class ForeignObject(RelatedField):
super
(
ForeignObject
,
self
)
.
__init__
(
**
kwargs
)
def
deconstruct
(
self
):
name
,
path
,
args
,
kwargs
=
super
(
ForeignObject
,
self
)
.
deconstruct
()
kwargs
[
'from_fields'
]
=
self
.
from_fields
kwargs
[
'to_fields'
]
=
self
.
to_fields
if
isinstance
(
self
.
rel
.
to
,
six
.
string_types
):
kwargs
[
'to'
]
=
self
.
rel
.
to
else
:
kwargs
[
'to'
]
=
"
%
s.
%
s"
%
(
self
.
rel
.
to
.
_meta
.
app_label
,
self
.
rel
.
to
.
_meta
.
object_name
)
return
name
,
path
,
args
,
kwargs
def
resolve_related_fields
(
self
):
if
len
(
self
.
from_fields
)
<
1
or
len
(
self
.
from_fields
)
!=
len
(
self
.
to_fields
):
raise
ValueError
(
'Foreign Object from and to fields must be the same non-zero length'
)
...
...
@@ -1243,6 +1253,8 @@ class ForeignKey(ForeignObject):
def
deconstruct
(
self
):
name
,
path
,
args
,
kwargs
=
super
(
ForeignKey
,
self
)
.
deconstruct
()
del
kwargs
[
'to_fields'
]
del
kwargs
[
'from_fields'
]
# Handle the simpler arguments
if
self
.
db_index
:
del
kwargs
[
'db_index'
]
...
...
@@ -1255,10 +1267,6 @@ class ForeignKey(ForeignObject):
# Rel needs more work.
if
self
.
rel
.
field_name
:
kwargs
[
'to_field'
]
=
self
.
rel
.
field_name
if
isinstance
(
self
.
rel
.
to
,
six
.
string_types
):
kwargs
[
'to'
]
=
self
.
rel
.
to
else
:
kwargs
[
'to'
]
=
"
%
s.
%
s"
%
(
self
.
rel
.
to
.
_meta
.
app_label
,
self
.
rel
.
to
.
_meta
.
object_name
)
return
name
,
path
,
args
,
kwargs
@property
...
...
tests/serializers/models.py
Dosyayı görüntüle @
621c25c4
...
...
@@ -115,6 +115,11 @@ class TeamField(six.with_metaclass(models.SubfieldBase, models.CharField)):
def
value_to_string
(
self
,
obj
):
return
self
.
_get_val_from_obj
(
obj
)
.
to_string
()
def
deconstruct
(
self
):
name
,
path
,
args
,
kwargs
=
super
(
TeamField
,
self
)
.
deconstruct
()
del
kwargs
[
'max_length'
]
return
name
,
path
,
args
,
kwargs
@python_2_unicode_compatible
class
Player
(
models
.
Model
):
...
...
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