Custom Search

Wednesday, November 30, 2016

python django AttributeError: 'module' object has no attribute 'commit_manually'

Error:
@transaction.commit_manually
AttributeError: 'module' object has no attribute 'commit_manually'

Fix:
def disable_auto_commit(func):
    def wrapper(*args, **kwargs):
        transaction.set_autocommit(False)
        return func(*args, **kwargs)
    return wrapper


@disable_auto_commit
def my_view(request):
       .... .....
      ..... .....



No comments:

Post a Comment