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
8f4eee17
Unverified
Kaydet (Commit)
8f4eee17
authored
Ock 11, 2019
tarafından
Tim Graham
Kaydeden (comit)
GitHub
Ock 11, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Moved django.db.migrations.writer.SettingsReference to django.conf.
Reduces the possibility of circular imports.
üst
76d31be2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
21 deletions
+18
-21
__init__.py
django/conf/__init__.py
+12
-0
serializer.py
django/db/migrations/serializer.py
+1
-1
writer.py
django/db/migrations/writer.py
+2
-14
related.py
django/db/models/fields/related.py
+1
-2
test_writer.py
tests/migrations/test_writer.py
+2
-4
No files found.
django/conf/__init__.py
Dosyayı görüntüle @
8f4eee17
...
@@ -30,6 +30,18 @@ FILE_CHARSET_DEPRECATED_MSG = (
...
@@ -30,6 +30,18 @@ FILE_CHARSET_DEPRECATED_MSG = (
)
)
class
SettingsReference
(
str
):
"""
String subclass which references a current settings value. It's treated as
the value in memory but serializes to a settings.NAME attribute reference.
"""
def
__new__
(
self
,
value
,
setting_name
):
return
str
.
__new__
(
self
,
value
)
def
__init__
(
self
,
value
,
setting_name
):
self
.
setting_name
=
setting_name
class
LazySettings
(
LazyObject
):
class
LazySettings
(
LazyObject
):
"""
"""
A lazy proxy for either global Django settings or a custom settings object.
A lazy proxy for either global Django settings or a custom settings object.
...
...
django/db/migrations/serializer.py
Dosyayı görüntüle @
8f4eee17
...
@@ -9,6 +9,7 @@ import re
...
@@ -9,6 +9,7 @@ import re
import
types
import
types
import
uuid
import
uuid
from
django.conf
import
SettingsReference
from
django.db
import
models
from
django.db
import
models
from
django.db.migrations.operations.base
import
Operation
from
django.db.migrations.operations.base
import
Operation
from
django.db.migrations.utils
import
COMPILED_REGEX_TYPE
,
RegexObject
from
django.db.migrations.utils
import
COMPILED_REGEX_TYPE
,
RegexObject
...
@@ -271,7 +272,6 @@ class UUIDSerializer(BaseSerializer):
...
@@ -271,7 +272,6 @@ class UUIDSerializer(BaseSerializer):
def
serializer_factory
(
value
):
def
serializer_factory
(
value
):
from
django.db.migrations.writer
import
SettingsReference
if
isinstance
(
value
,
Promise
):
if
isinstance
(
value
,
Promise
):
value
=
str
(
value
)
value
=
str
(
value
)
elif
isinstance
(
value
,
LazyObject
):
elif
isinstance
(
value
,
LazyObject
):
...
...
django/db/migrations/writer.py
Dosyayı görüntüle @
8f4eee17
...
@@ -4,6 +4,8 @@ from importlib import import_module
...
@@ -4,6 +4,8 @@ from importlib import import_module
from
django
import
get_version
from
django
import
get_version
from
django.apps
import
apps
from
django.apps
import
apps
# SettingsReference imported for backwards compatibility in Django 2.2.
from
django.conf
import
SettingsReference
# NOQA
from
django.db
import
migrations
from
django.db
import
migrations
from
django.db.migrations.loader
import
MigrationLoader
from
django.db.migrations.loader
import
MigrationLoader
from
django.db.migrations.serializer
import
serializer_factory
from
django.db.migrations.serializer
import
serializer_factory
...
@@ -12,20 +14,6 @@ from django.utils.module_loading import module_dir
...
@@ -12,20 +14,6 @@ from django.utils.module_loading import module_dir
from
django.utils.timezone
import
now
from
django.utils.timezone
import
now
class
SettingsReference
(
str
):
"""
Special subclass of string which actually references a current settings
value. It's treated as the value in memory, but serializes out to a
settings.NAME attribute reference.
"""
def
__new__
(
self
,
value
,
setting_name
):
return
str
.
__new__
(
self
,
value
)
def
__init__
(
self
,
value
,
setting_name
):
self
.
setting_name
=
setting_name
class
OperationWriter
:
class
OperationWriter
:
def
__init__
(
self
,
operation
,
indentation
=
2
):
def
__init__
(
self
,
operation
,
indentation
=
2
):
self
.
operation
=
operation
self
.
operation
=
operation
...
...
django/db/models/fields/related.py
Dosyayı görüntüle @
8f4eee17
...
@@ -4,6 +4,7 @@ from functools import partial
...
@@ -4,6 +4,7 @@ from functools import partial
from
django
import
forms
from
django
import
forms
from
django.apps
import
apps
from
django.apps
import
apps
from
django.conf
import
SettingsReference
from
django.core
import
checks
,
exceptions
from
django.core
import
checks
,
exceptions
from
django.db
import
connection
,
router
from
django.db
import
connection
,
router
from
django.db.backends
import
utils
from
django.db.backends
import
utils
...
@@ -590,7 +591,6 @@ class ForeignObject(RelatedField):
...
@@ -590,7 +591,6 @@ class ForeignObject(RelatedField):
%
(
kwargs
[
'to'
]
.
setting_name
,
swappable_setting
)
%
(
kwargs
[
'to'
]
.
setting_name
,
swappable_setting
)
)
)
# Set it
# Set it
from
django.db.migrations.writer
import
SettingsReference
kwargs
[
'to'
]
=
SettingsReference
(
kwargs
[
'to'
]
=
SettingsReference
(
kwargs
[
'to'
],
kwargs
[
'to'
],
swappable_setting
,
swappable_setting
,
...
@@ -1457,7 +1457,6 @@ class ManyToManyField(RelatedField):
...
@@ -1457,7 +1457,6 @@ class ManyToManyField(RelatedField):
"(
%
s and
%
s)"
%
(
kwargs
[
'to'
]
.
setting_name
,
swappable_setting
)
"(
%
s and
%
s)"
%
(
kwargs
[
'to'
]
.
setting_name
,
swappable_setting
)
)
)
from
django.db.migrations.writer
import
SettingsReference
kwargs
[
'to'
]
=
SettingsReference
(
kwargs
[
'to'
]
=
SettingsReference
(
kwargs
[
'to'
],
kwargs
[
'to'
],
swappable_setting
,
swappable_setting
,
...
...
tests/migrations/test_writer.py
Dosyayı görüntüle @
8f4eee17
...
@@ -12,12 +12,10 @@ import custom_migration_operations.more_operations
...
@@ -12,12 +12,10 @@ import custom_migration_operations.more_operations
import
custom_migration_operations.operations
import
custom_migration_operations.operations
from
django
import
get_version
from
django
import
get_version
from
django.conf
import
settings
from
django.conf
import
SettingsReference
,
settings
from
django.core.validators
import
EmailValidator
,
RegexValidator
from
django.core.validators
import
EmailValidator
,
RegexValidator
from
django.db
import
migrations
,
models
from
django.db
import
migrations
,
models
from
django.db.migrations.writer
import
(
from
django.db.migrations.writer
import
MigrationWriter
,
OperationWriter
MigrationWriter
,
OperationWriter
,
SettingsReference
,
)
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.utils.deconstruct
import
deconstructible
from
django.utils.deconstruct
import
deconstructible
from
django.utils.functional
import
SimpleLazyObject
from
django.utils.functional
import
SimpleLazyObject
...
...
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