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
68e0a169
Kaydet (Commit)
68e0a169
authored
Tem 30, 2013
tarafından
Andrew Godwin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Rename pre_ and post_syncdb to *_migrate, with aliases from old names
üst
086389f5
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
113 additions
and
74 deletions
+113
-74
__init__.py
django/contrib/auth/management/__init__.py
+2
-2
management.py
django/contrib/contenttypes/management.py
+1
-1
creation.py
django/contrib/gis/db/backends/spatialite/creation.py
+1
-1
management.py
django/contrib/sites/management.py
+1
-1
flush.py
django/core/management/commands/flush.py
+11
-11
migrate.py
django/core/management/commands/migrate.py
+14
-7
sql.py
django/core/management/sql.py
+8
-8
creation.py
django/db/backends/creation.py
+1
-1
signals.py
django/db/models/signals.py
+4
-2
testcases.py
django/test/testcases.py
+5
-6
sites.txt
docs/ref/contrib/sites.txt
+1
-1
signals.txt
docs/ref/signals.txt
+59
-28
advanced.txt
docs/topics/testing/advanced.txt
+5
-5
No files found.
django/contrib/auth/management/__init__.py
Dosyayı görüntüle @
68e0a169
...
...
@@ -187,7 +187,7 @@ def get_default_username(check_db=True):
return
''
return
default_username
signals
.
post_
syncdb
.
connect
(
create_permissions
,
signals
.
post_
migrate
.
connect
(
create_permissions
,
dispatch_uid
=
"django.contrib.auth.management.create_permissions"
)
signals
.
post_
syncdb
.
connect
(
create_superuser
,
signals
.
post_
migrate
.
connect
(
create_superuser
,
sender
=
auth_app
,
dispatch_uid
=
"django.contrib.auth.management.create_superuser"
)
django/contrib/contenttypes/management.py
Dosyayı görüntüle @
68e0a169
...
...
@@ -88,7 +88,7 @@ def update_all_contenttypes(verbosity=2, **kwargs):
for
app
in
get_apps
():
update_contenttypes
(
app
,
None
,
verbosity
,
**
kwargs
)
signals
.
post_
syncdb
.
connect
(
update_contenttypes
)
signals
.
post_
migrate
.
connect
(
update_contenttypes
)
if
__name__
==
"__main__"
:
update_all_contenttypes
()
django/contrib/gis/db/backends/spatialite/creation.py
Dosyayı görüntüle @
68e0a169
...
...
@@ -45,7 +45,7 @@ class SpatiaLiteCreation(DatabaseCreation):
# We need to then do a flush to ensure that any data installed by
# custom SQL has been removed. The only test data should come from
# test fixtures, or autogenerated from post_
syncdb
triggers.
# test fixtures, or autogenerated from post_
migrate
triggers.
# This has the side effect of loading initial data (which was
# intentionally skipped in the syncdb).
call_command
(
'flush'
,
...
...
django/contrib/sites/management.py
Dosyayı görüntüle @
68e0a169
...
...
@@ -33,4 +33,4 @@ def create_default_site(app, created_models, verbosity, db, **kwargs):
Site
.
objects
.
clear_cache
()
signals
.
post_
syncdb
.
connect
(
create_default_site
,
sender
=
site_app
)
signals
.
post_
migrate
.
connect
(
create_default_site
,
sender
=
site_app
)
django/core/management/commands/flush.py
Dosyayı görüntüle @
68e0a169
...
...
@@ -6,7 +6,7 @@ from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS
from
django.core.management
import
call_command
from
django.core.management.base
import
NoArgsCommand
,
CommandError
from
django.core.management.color
import
no_style
from
django.core.management.sql
import
sql_flush
,
emit_post_
sync
_signal
from
django.core.management.sql
import
sql_flush
,
emit_post_
migrate
_signal
from
django.utils.importlib
import
import_module
from
django.utils.six.moves
import
input
from
django.utils
import
six
...
...
@@ -23,8 +23,8 @@ class Command(NoArgsCommand):
help
=
'Tells Django not to load any initial data after database synchronization.'
),
)
help
=
(
'Returns the database to the state it was in immediately after '
'
syncdb was
executed. This means that all data will be removed '
'from the database, any post-
synchroniz
ation handlers will be '
'
migrate was first
executed. This means that all data will be removed '
'from the database, any post-
migr
ation handlers will be '
're-executed, and the initial_data fixture will be re-installed.'
)
def
handle_noargs
(
self
,
**
options
):
...
...
@@ -35,7 +35,7 @@ class Command(NoArgsCommand):
# The following are stealth options used by Django's internals.
reset_sequences
=
options
.
get
(
'reset_sequences'
,
True
)
allow_cascade
=
options
.
get
(
'allow_cascade'
,
False
)
inhibit_post_
syncdb
=
options
.
get
(
'inhibit_post_syncdb
'
,
False
)
inhibit_post_
migrate
=
options
.
get
(
'inhibit_post_migrate
'
,
False
)
self
.
style
=
no_style
()
...
...
@@ -54,7 +54,7 @@ class Command(NoArgsCommand):
if
interactive
:
confirm
=
input
(
"""You have requested a flush of the database.
This will IRREVERSIBLY DESTROY all data currently in the
%
r database,
and return each table to
the state it was in after syncdb
.
and return each table to
a fresh state
.
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: """
%
connection
.
settings_dict
[
'NAME'
])
...
...
@@ -77,8 +77,8 @@ Are you sure you want to do this?
"The full error:
%
s"
)
%
(
connection
.
settings_dict
[
'NAME'
],
e
)
six
.
reraise
(
CommandError
,
CommandError
(
new_msg
),
sys
.
exc_info
()[
2
])
if
not
inhibit_post_
syncdb
:
self
.
emit_post_
syncdb
(
verbosity
,
interactive
,
db
)
if
not
inhibit_post_
migrate
:
self
.
emit_post_
migrate
(
verbosity
,
interactive
,
db
)
# Reinstall the initial_data fixture.
if
options
.
get
(
'load_initial_data'
):
...
...
@@ -89,13 +89,13 @@ Are you sure you want to do this?
self
.
stdout
.
write
(
"Flush cancelled.
\n
"
)
@staticmethod
def
emit_post_
syncdb
(
verbosity
,
interactive
,
database
):
# Emit the post
sync
signal. This allows individual applications to
# respond as if the database had been
sync'
d from scratch.
def
emit_post_
migrate
(
verbosity
,
interactive
,
database
):
# Emit the post
migrate
signal. This allows individual applications to
# respond as if the database had been
migrate
d from scratch.
all_models
=
[]
for
app
in
models
.
get_apps
():
all_models
.
extend
([
m
for
m
in
models
.
get_models
(
app
,
include_auto_created
=
True
)
if
router
.
allow_syncdb
(
database
,
m
)
])
emit_post_
sync
_signal
(
set
(
all_models
),
verbosity
,
interactive
,
database
)
emit_post_
migrate
_signal
(
set
(
all_models
),
verbosity
,
interactive
,
database
)
django/core/management/commands/migrate.py
Dosyayı görüntüle @
68e0a169
...
...
@@ -6,7 +6,7 @@ from django.conf import settings
from
django.core.management
import
call_command
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.color
import
color_style
,
no_style
from
django.core.management.sql
import
custom_sql_for_model
,
emit_post_
sync_signal
,
emit_pre_sync
_signal
from
django.core.management.sql
import
custom_sql_for_model
,
emit_post_
migrate_signal
,
emit_pre_migrate
_signal
from
django.db
import
connections
,
router
,
transaction
,
models
,
DEFAULT_DB_ALIAS
from
django.db.migrations.executor
import
MigrationExecutor
from
django.db.migrations.loader
import
AmbiguityError
...
...
@@ -99,10 +99,14 @@ class Command(BaseCommand):
# Run the syncdb phase.
# If you ever manage to get rid of this, I owe you many, many drinks.
# Note that pre_migrate is called from inside here, as it needs
# the list of models about to be installed.
if
run_syncdb
:
if
self
.
verbosity
>=
1
:
self
.
stdout
.
write
(
self
.
style
.
MIGRATE_HEADING
(
"Synchronizing apps without migrations:"
))
self
.
sync_apps
(
connection
,
executor
.
loader
.
unmigrated_apps
)
created_models
=
self
.
sync_apps
(
connection
,
executor
.
loader
.
unmigrated_apps
)
else
:
created_models
=
[]
# Migrate!
if
self
.
verbosity
>=
1
:
...
...
@@ -113,6 +117,10 @@ class Command(BaseCommand):
else
:
executor
.
migrate
(
targets
,
plan
,
fake
=
options
.
get
(
"fake"
,
False
))
# Send the post_migrate signal, so individual apps can do whatever they need
# to do at this point.
emit_post_migrate_signal
(
created_models
,
self
.
verbosity
,
self
.
interactive
,
connection
.
alias
)
def
migration_progress_callback
(
self
,
action
,
migration
):
if
self
.
verbosity
>=
1
:
if
action
==
"apply_start"
:
...
...
@@ -159,7 +167,7 @@ class Command(BaseCommand):
)
create_models
=
set
([
x
for
x
in
itertools
.
chain
(
*
manifest
.
values
())])
emit_pre_
sync
_signal
(
create_models
,
self
.
verbosity
,
self
.
interactive
,
connection
.
alias
)
emit_pre_
migrate
_signal
(
create_models
,
self
.
verbosity
,
self
.
interactive
,
connection
.
alias
)
# Create the tables for each model
if
self
.
verbosity
>=
1
:
...
...
@@ -188,10 +196,6 @@ class Command(BaseCommand):
# If you can prove we don't need this, remove it.
transaction
.
set_dirty
(
using
=
connection
.
alias
)
# Send the post_syncdb signal, so individual apps can do whatever they need
# to do at this point.
emit_post_sync_signal
(
created_models
,
self
.
verbosity
,
self
.
interactive
,
connection
.
alias
)
# The connection may have been closed by a syncdb handler.
cursor
=
connection
.
cursor
()
...
...
@@ -220,6 +224,7 @@ class Command(BaseCommand):
if
self
.
verbosity
>=
1
:
self
.
stdout
.
write
(
" Installing indexes...
\n
"
)
# Install SQL indices for all newly created models
for
app_name
,
model_list
in
manifest
.
items
():
for
model
in
model_list
:
...
...
@@ -238,3 +243,5 @@ class Command(BaseCommand):
# Load initial_data fixtures (unless that has been disabled)
if
self
.
load_initial_data
:
call_command
(
'loaddata'
,
'initial_data'
,
verbosity
=
self
.
verbosity
,
database
=
connection
.
alias
,
skip_validation
=
True
)
return
created_models
django/core/management/sql.py
Dosyayı görüntüle @
68e0a169
...
...
@@ -192,25 +192,25 @@ def custom_sql_for_model(model, style, connection):
return
output
def
emit_pre_
sync
_signal
(
create_models
,
verbosity
,
interactive
,
db
):
# Emit the pre_
sync
signal for every application.
def
emit_pre_
migrate
_signal
(
create_models
,
verbosity
,
interactive
,
db
):
# Emit the pre_
migrate
signal for every application.
for
app
in
models
.
get_apps
():
app_name
=
app
.
__name__
.
split
(
'.'
)[
-
2
]
if
verbosity
>=
2
:
print
(
"Running pre-
sync
handlers for application
%
s"
%
app_name
)
models
.
signals
.
pre_
syncdb
.
send
(
sender
=
app
,
app
=
app
,
print
(
"Running pre-
migrate
handlers for application
%
s"
%
app_name
)
models
.
signals
.
pre_
migrate
.
send
(
sender
=
app
,
app
=
app
,
create_models
=
create_models
,
verbosity
=
verbosity
,
interactive
=
interactive
,
db
=
db
)
def
emit_post_
sync
_signal
(
created_models
,
verbosity
,
interactive
,
db
):
# Emit the post_
sync
signal for every application.
def
emit_post_
migrate
_signal
(
created_models
,
verbosity
,
interactive
,
db
):
# Emit the post_
migrate
signal for every application.
for
app
in
models
.
get_apps
():
app_name
=
app
.
__name__
.
split
(
'.'
)[
-
2
]
if
verbosity
>=
2
:
print
(
"Running post-
sync
handlers for application
%
s"
%
app_name
)
models
.
signals
.
post_
syncdb
.
send
(
sender
=
app
,
app
=
app
,
print
(
"Running post-
migrate
handlers for application
%
s"
%
app_name
)
models
.
signals
.
post_
migrate
.
send
(
sender
=
app
,
app
=
app
,
created_models
=
created_models
,
verbosity
=
verbosity
,
interactive
=
interactive
,
db
=
db
)
django/db/backends/creation.py
Dosyayı görüntüle @
68e0a169
...
...
@@ -344,7 +344,7 @@ class BaseDatabaseCreation(object):
# We need to then do a flush to ensure that any data installed by
# custom SQL has been removed. The only test data should come from
# test fixtures, or autogenerated from post_
syncdb
triggers.
# test fixtures, or autogenerated from post_
migrate
triggers.
# This has the side effect of loading initial data (which was
# intentionally skipped in the syncdb).
call_command
(
'flush'
,
...
...
django/db/models/signals.py
Dosyayı görüntüle @
68e0a169
...
...
@@ -12,7 +12,9 @@ post_save = Signal(providing_args=["instance", "raw", "created", "using", "updat
pre_delete
=
Signal
(
providing_args
=
[
"instance"
,
"using"
],
use_caching
=
True
)
post_delete
=
Signal
(
providing_args
=
[
"instance"
,
"using"
],
use_caching
=
True
)
pre_syncdb
=
Signal
(
providing_args
=
[
"app"
,
"create_models"
,
"verbosity"
,
"interactive"
,
"db"
])
post_syncdb
=
Signal
(
providing_args
=
[
"class"
,
"app"
,
"created_models"
,
"verbosity"
,
"interactive"
,
"db"
],
use_caching
=
True
)
pre_migrate
=
Signal
(
providing_args
=
[
"app"
,
"create_models"
,
"verbosity"
,
"interactive"
,
"db"
])
pre_syncdb
=
pre_migrate
post_migrate
=
Signal
(
providing_args
=
[
"class"
,
"app"
,
"created_models"
,
"verbosity"
,
"interactive"
,
"db"
],
use_caching
=
True
)
post_syncdb
=
post_migrate
m2m_changed
=
Signal
(
providing_args
=
[
"action"
,
"instance"
,
"reverse"
,
"model"
,
"pk_set"
,
"using"
],
use_caching
=
True
)
django/test/testcases.py
Dosyayı görüntüle @
68e0a169
...
...
@@ -718,7 +718,7 @@ class TransactionTestCase(SimpleTestCase):
"""Performs any pre-test setup. This includes:
* If the class has an 'available_apps' attribute, restricting the app
cache to these applications, then firing post_
syncdb
-- it must run
cache to these applications, then firing post_
migrate
-- it must run
with the correct set of applications for the test case.
* If the class has a 'fixtures' attribute, installing these fixtures.
"""
...
...
@@ -726,8 +726,7 @@ class TransactionTestCase(SimpleTestCase):
if
self
.
available_apps
is
not
None
:
cache
.
set_available_apps
(
self
.
available_apps
)
for
db_name
in
self
.
_databases_names
(
include_mirrors
=
False
):
flush
.
Command
.
emit_post_syncdb
(
verbosity
=
0
,
interactive
=
False
,
database
=
db_name
)
flush
.
Command
.
emit_post_migrate
(
verbosity
=
0
,
interactive
=
False
,
database
=
db_name
)
try
:
self
.
_fixture_setup
()
except
Exception
:
...
...
@@ -772,7 +771,7 @@ class TransactionTestCase(SimpleTestCase):
"""Performs any post-test things. This includes:
* Flushing the contents of the database, to leave a clean slate. If
the class has an 'available_apps' attribute, post_
syncdb
isn't fired.
the class has an 'available_apps' attribute, post_
migrate
isn't fired.
* Force-closing the connection, so the next test gets a clean cursor.
"""
try
:
...
...
@@ -790,14 +789,14 @@ class TransactionTestCase(SimpleTestCase):
cache
.
unset_available_apps
()
def
_fixture_teardown
(
self
):
# Allow TRUNCATE ... CASCADE and don't emit the post_
syncdb
signal
# Allow TRUNCATE ... CASCADE and don't emit the post_
migrate
signal
# when flushing only a subset of the apps
for
db_name
in
self
.
_databases_names
(
include_mirrors
=
False
):
call_command
(
'flush'
,
verbosity
=
0
,
interactive
=
False
,
database
=
db_name
,
skip_validation
=
True
,
reset_sequences
=
False
,
allow_cascade
=
self
.
available_apps
is
not
None
,
inhibit_post_
syncdb
=
self
.
available_apps
is
not
None
)
inhibit_post_
migrate
=
self
.
available_apps
is
not
None
)
def
assertQuerysetEqual
(
self
,
qs
,
values
,
transform
=
repr
,
ordered
=
True
):
items
=
six
.
moves
.
map
(
transform
,
qs
)
...
...
docs/ref/contrib/sites.txt
Dosyayı görüntüle @
68e0a169
...
...
@@ -267,7 +267,7 @@ To enable the sites framework, follow these steps:
3. Run :djadmin:`migrate`.
``django.contrib.sites`` registers a
:data:`~django.db.models.signals.post_
syncdb
` signal handler which creates a
:data:`~django.db.models.signals.post_
migrate
` signal handler which creates a
default site named ``example.com`` with the domain ``example.com``. This site
will also be created after Django creates the test database. To set the
correct name and domain for your project, you can use an :doc:`initial data
...
...
docs/ref/signals.txt
Dosyayı görüntüle @
68e0a169
...
...
@@ -360,40 +360,36 @@ Management signals
Signals sent by :doc:`django-admin </ref/django-admin>`.
pre_
syncdb
----------
pre_
migrate
----------
-
.. data:: django.db.models.signals.pre_
syncdb
.. data:: django.db.models.signals.pre_
migrate
:module:
Sent by the :djadmin:`
syncdb
` command before it starts to install an
Sent by the :djadmin:`
migrate
` command before it starts to install an
application.
Any handlers that listen to this signal need to be written in a particular
place: a ``management`` module in one of your :setting:`INSTALLED_APPS`. If
handlers are registered anywhere else they may not be loaded by
:djadmin:`
syncdb
`.
:djadmin:`
migrate
`.
Arguments sent with this signal:
``sender``
The ``models`` module that was just installed. That is, if
:djadmin:`syncdb` just installed an app called ``"foo.bar.myapp"``,
``sender`` will be the ``foo.bar.myapp.models`` module.
The ``models`` module of the app about to be migrated/synced.
For example, if :djadmin:`migrate` is about to install
an app called ``"foo.bar.myapp"``, ``sender`` will be the
``foo.bar.myapp.models`` module.
``app``
Same as ``sender``.
``create_models``
A list of the model classes from any app which :djadmin:`syncdb` plans to
create.
``verbosity``
Indicates how much information manage.py is printing on screen. See
the :djadminopt:`--verbosity` flag for details.
Functions which listen for :data:`pre_
syncdb
` should adjust what they
Functions which listen for :data:`pre_
migrate
` should adjust what they
output to the screen based on the value of this argument.
``interactive``
...
...
@@ -407,42 +403,57 @@ Arguments sent with this signal:
``db``
The alias of database on which a command will operate.
post_syncdb
-----------
.. data:: django.db.models.signals.post_syncdb
pre_syncdb
----------
.. data:: django.db.models.signals.pre_syncdb
:module:
Sent by the :djadmin:`syncdb` command after it installs an application, and the
.. deprecated:: 1.7
This signal has been renamed to :data:`~django.db.models.signals.pre_migrate`.
Alias of :data:`django.db.models.signals.pre_migrate`. As long as this alias
is present, for backwards-compatability this signal has an extra argument it sends:
``create_models``
A list of the model classes from any app which :djadmin:`migrate` is
going to create, **only if the app has no migrations**.
post_migrate
------------
.. data:: django.db.models.signals.post_migrate
:module:
Sent by the :djadmin:`migrate` command after it installs an application, and the
:djadmin:`flush` command.
Any handlers that listen to this signal need to be written in a particular
place: a ``management`` module in one of your :setting:`INSTALLED_APPS`. If
handlers are registered anywhere else they may not be loaded by
:djadmin:`
syncdb
`. It is important that handlers of this signal perform
:djadmin:`
migrate
`. It is important that handlers of this signal perform
idempotent changes (e.g. no database alterations) as this may cause the
:djadmin:`flush` management command to fail if it also ran during the
:djadmin:`
syncdb
` command.
:djadmin:`
migrate
` command.
Arguments sent with this signal:
``sender``
The ``models`` module that was just installed. That is, if
:djadmin:`
syncdb
` just installed an app called ``"foo.bar.myapp"``,
:djadmin:`
migrate
` just installed an app called ``"foo.bar.myapp"``,
``sender`` will be the ``foo.bar.myapp.models`` module.
``app``
Same as ``sender``.
``created_models``
A list of the model classes from any app which :djadmin:`syncdb` has
created so far.
``verbosity``
Indicates how much information manage.py is printing on screen. See
the :djadminopt:`--verbosity` flag for details.
Functions which listen for :data:`post_
syncdb
` should adjust what they
Functions which listen for :data:`post_
migrate
` should adjust what they
output to the screen based on the value of this argument.
``interactive``
...
...
@@ -459,14 +470,34 @@ Arguments sent with this signal:
For example, ``yourapp/management/__init__.py`` could be written like::
from django.db.models.signals import post_
syncdb
from django.db.models.signals import post_
migrate
import yourapp.models
def my_callback(sender, **kwargs):
# Your specific logic here
pass
post_syncdb.connect(my_callback, sender=yourapp.models)
post_migrate.connect(my_callback, sender=yourapp.models)
post_syncdb
-----------
.. data:: django.db.models.signals.post_syncdb
:module:
.. deprecated:: 1.7
This signal has been renamed to :data:`~django.db.models.signals.post_migrate`.
Alias of :data:`django.db.models.signals.post_migrate`. As long as this alias
is present, for backwards-compatability this signal has an extra argument it sends:
``created_models``
A list of the model classes from any app which :djadmin:`migrate` has
created, **only if the app has no migrations**.
Request/response signals
========================
...
...
docs/topics/testing/advanced.txt
Dosyayı görüntüle @
68e0a169
...
...
@@ -182,7 +182,7 @@ Advanced features of ``TransactionTestCase``
By default, ``available_apps`` is set to ``None``. After each test, Django
calls :djadmin:`flush` to reset the database state. This empties all tables
and emits the :data:`~django.db.models.signals.post_
syncdb
` signal, which
and emits the :data:`~django.db.models.signals.post_
migrate
` signal, which
re-creates one content type and three permissions for each model. This
operation gets expensive proportionally to the number of models.
...
...
@@ -190,13 +190,13 @@ Advanced features of ``TransactionTestCase``
behave as if only the models from these applications were available. The
behavior of ``TransactionTestCase`` changes as follows:
- :data:`~django.db.models.signals.post_
syncdb
` is fired before each
- :data:`~django.db.models.signals.post_
migrate
` is fired before each
test to create the content types and permissions for each model in
available apps, in case they're missing.
- After each test, Django empties only tables corresponding to models in
available apps. However, at the database level, truncation may cascade to
related models in unavailable apps. Furthermore
:data:`~django.db.models.signals.post_
syncdb
` isn't fired; it will be
:data:`~django.db.models.signals.post_
migrate
` isn't fired; it will be
fired by the next ``TransactionTestCase``, after the correct set of
applications is selected.
...
...
@@ -205,10 +205,10 @@ Advanced features of ``TransactionTestCase``
cause unrelated tests to fail. Be careful with tests that use sessions;
the default session engine stores them in the database.
Since :data:`~django.db.models.signals.post_
syncdb
` isn't emitted after
Since :data:`~django.db.models.signals.post_
migrate
` isn't emitted after
flushing the database, its state after a ``TransactionTestCase`` isn't the
same as after a ``TestCase``: it's missing the rows created by listeners
to :data:`~django.db.models.signals.post_
syncdb
`. Considering the
to :data:`~django.db.models.signals.post_
migrate
`. Considering the
:ref:`order in which tests are executed <order-of-tests>`, this isn't an
issue, provided either all ``TransactionTestCase`` in a given test suite
declare ``available_apps``, or none of them.
...
...
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