Adding data in a transaction

1
2
3
4
5
6
7
8
9
from django.db import transaction

@transaction.commit_manually
def viewfunc(request):
    ...
    for item in items:
        entry = Entry(a1=item.a1, a2=item.a2)
        entry.save()
    transaction.commit()

More like this

  1. Bulk Insert - updated 5/9/2008 by coolie 5 years, 7 months ago
  2. Comma Seprated Character Field to store Geographic Coordinates by vijay.shanker 5 months, 1 week ago
  3. Database cleanup by skyjur 2 years, 10 months ago
  4. syncdata command by graham 4 years, 10 months ago
  5. MintCache by gfranxman 6 years, 1 month ago

Comments

(Forgotten your password?)