mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Deprecated TransactionMiddleware and TRANSACTIONS_MANAGED.
Replaced them with per-database options, for proper multi-db support. Also toned down the recommendation to tie transactions to HTTP requests. Thanks Jeremy for sharing his experience.
This commit is contained in:
parent
f7245b83bb
commit
ac37ed21b3
12 changed files with 217 additions and 51 deletions
17
tests/handlers/views.py
Normal file
17
tests/handlers/views.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import connection
|
||||
from django.http import HttpResponse, StreamingHttpResponse
|
||||
|
||||
def regular(request):
|
||||
return HttpResponse(b"regular content")
|
||||
|
||||
def streaming(request):
|
||||
return StreamingHttpResponse([b"streaming", b" ", b"content"])
|
||||
|
||||
def in_transaction(request):
|
||||
return HttpResponse(str(connection.in_atomic_block))
|
||||
|
||||
def not_in_transaction(request):
|
||||
return HttpResponse(str(connection.in_atomic_block))
|
||||
not_in_transaction.transactions_per_request = False
|
Loading…
Add table
Add a link
Reference in a new issue