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
c72eb80d
Kaydet (Commit)
c72eb80d
authored
Ara 12, 2014
tarafından
Carl Meyer
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23455 -- Accept either bytes or text for related_name, convert to text.
üst
d4bdddee
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
related.py
django/db/models/fields/related.py
+2
-2
1.7.2.txt
docs/releases/1.7.2.txt
+3
-3
models.py
tests/model_fields/models.py
+1
-1
tests.py
tests/model_fields/tests.py
+4
-0
No files found.
django/db/models/fields/related.py
Dosyayı görüntüle @
c72eb80d
...
...
@@ -14,7 +14,7 @@ from django.db.models.lookups import IsNull
from
django.db.models.related
import
RelatedObject
,
PathInfo
from
django.db.models.query
import
QuerySet
from
django.db.models.expressions
import
Col
from
django.utils.encoding
import
smart_text
from
django.utils.encoding
import
force_text
,
smart_text
from
django.utils
import
six
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.functional
import
curry
,
cached_property
...
...
@@ -280,7 +280,7 @@ class RelatedField(Field):
sup
.
contribute_to_class
(
cls
,
name
,
virtual_only
=
virtual_only
)
if
not
cls
.
_meta
.
abstract
and
self
.
rel
.
related_name
:
related_name
=
self
.
rel
.
related_name
%
{
related_name
=
force_text
(
self
.
rel
.
related_name
)
%
{
'class'
:
cls
.
__name__
.
lower
(),
'app_label'
:
cls
.
_meta
.
app_label
.
lower
()
}
...
...
docs/releases/1.7.2.txt
Dosyayı görüntüle @
c72eb80d
...
...
@@ -125,6 +125,6 @@ Bugfixes
* Fixed a crash in the admin when using "Save as new" and also deleting a
related inline (:ticket:`23857`).
*
Removed auto-conversion of ``related_name`` to unicode in fiel
d
deconstruction, to maintain consistency of bytes/text in migrations matching
the original values
(:ticket:`23455` and :ticket:`23982`).
*
Always converted ``related_name`` to text (unicode), since that is require
d
on Python 3 for interpolation. Removed conversion of ``related_name`` to text
in migration deconstruction
(:ticket:`23455` and :ticket:`23982`).
tests/model_fields/models.py
Dosyayı görüntüle @
c72eb80d
...
...
@@ -25,7 +25,7 @@ def get_foo():
class
Bar
(
models
.
Model
):
b
=
models
.
CharField
(
max_length
=
10
)
a
=
models
.
ForeignKey
(
Foo
,
default
=
get_foo
)
a
=
models
.
ForeignKey
(
Foo
,
default
=
get_foo
,
related_name
=
b
'bars'
)
class
Whiz
(
models
.
Model
):
...
...
tests/model_fields/tests.py
Dosyayı görüntüle @
c72eb80d
...
...
@@ -199,6 +199,10 @@ class ForeignKeyTests(test.TestCase):
warnings
=
checks
.
run_checks
()
self
.
assertEqual
(
warnings
,
expected_warnings
)
def
test_related_name_converted_to_text
(
self
):
rel_name
=
Bar
.
_meta
.
get_field_by_name
(
'a'
)[
0
]
.
rel
.
related_name
self
.
assertIsInstance
(
rel_name
,
six
.
text_type
)
class
DateTimeFieldTests
(
unittest
.
TestCase
):
def
test_datetimefield_to_python_usecs
(
self
):
...
...
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