Loading AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -561,6 +561,7 @@ answer newbie questions, and generally made Django that much better: Peter Sheats <sheats@gmail.com> Pete Shinners <pete@shinners.org> Leo Shklovskii Zbigniew Siciarz <zbigniew@siciarz.net> jason.sidabras@gmail.com Mikołaj Siedlarek <mikolaj.siedlarek@gmail.com> Karol Sikora <elektrrrus@gmail.com> Loading docs/ref/applications.txt +13 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,19 @@ Methods def ready(self): MyModel = self.get_model('MyModel') .. warning:: Although you can access model classes as described above, avoid interacting with the database in your :meth:`ready()` implementation. This includes model methods that execute queries (:meth:`~django.db.models.Model.save()`, :meth:`~django.db.models.Model.delete()`, manager methods etc.), and also raw SQL queries via ``django.db.connection``. Your :meth:`ready()` method will run during startup of every management command. For example, even though the test database configuration is separate from the production settings, ``manage.py test`` would still execute some queries against your **production** database! .. _namespace package: Namespace packages as apps (Python 3.3+) Loading docs/topics/testing/overview.txt +5 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,11 @@ advanced settings. your tests. *It is a bad idea to have such import-time database queries in your code* anyway - rewrite your code so that it doesn't do this. .. versionadded:: 1.7 This also applies to customized implementations of :meth:`~django.apps.AppConfig.ready()`. .. seealso:: The :ref:`advanced multi-db testing topics <topics-testing-advanced-multidb>`. Loading Loading
AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -561,6 +561,7 @@ answer newbie questions, and generally made Django that much better: Peter Sheats <sheats@gmail.com> Pete Shinners <pete@shinners.org> Leo Shklovskii Zbigniew Siciarz <zbigniew@siciarz.net> jason.sidabras@gmail.com Mikołaj Siedlarek <mikolaj.siedlarek@gmail.com> Karol Sikora <elektrrrus@gmail.com> Loading
docs/ref/applications.txt +13 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,19 @@ Methods def ready(self): MyModel = self.get_model('MyModel') .. warning:: Although you can access model classes as described above, avoid interacting with the database in your :meth:`ready()` implementation. This includes model methods that execute queries (:meth:`~django.db.models.Model.save()`, :meth:`~django.db.models.Model.delete()`, manager methods etc.), and also raw SQL queries via ``django.db.connection``. Your :meth:`ready()` method will run during startup of every management command. For example, even though the test database configuration is separate from the production settings, ``manage.py test`` would still execute some queries against your **production** database! .. _namespace package: Namespace packages as apps (Python 3.3+) Loading
docs/topics/testing/overview.txt +5 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,11 @@ advanced settings. your tests. *It is a bad idea to have such import-time database queries in your code* anyway - rewrite your code so that it doesn't do this. .. versionadded:: 1.7 This also applies to customized implementations of :meth:`~django.apps.AppConfig.ready()`. .. seealso:: The :ref:`advanced multi-db testing topics <topics-testing-advanced-multidb>`. Loading