Django 2.1.x Documentation
database transaction, but only if the transaction suc- cessfully commits. Examples might include a Celery task, an email notification, or a cache invalidation. Django provides the on_commit() function to invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) You can also wrap your function in a lambda: transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function transaction, but they are not part of the transaction. For the intended use cases (mail notifications, Celery tasks, etc.), this should be fine. If it’s not (if your follow-up action is so critical that its0 码力 | 1910 页 | 6.49 MB | 1 年前3Django 1.11.x Documentation
database transaction, but only if the transaction suc- cessfully commits. Examples might include a Celery task, an email notification, or a cache invalidation. Django provides the on_commit() function to django.db import transaction def do_something(): pass # send a mail, invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) You can also wrap your function in a lambda: 3 149 Django Documentation, Release 1.11.30.dev20200305075726 transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function you pass in will be called immediately after a hypothetical database0 码力 | 1878 页 | 6.40 MB | 1 年前3Django 1.10.x Documentation
database transaction, but only if the transaction suc- cessfully commits. Examples might include a Celery task, an email notification, or a cache invalidation. Django provides the on_commit() function to invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) You can also wrap your function in a lambda: transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function transaction, but they are not part of the transaction. For the intended use cases (mail notifications, Celery tasks, etc.), this should be fine. If it’s not (if your follow-up action is so critical that its0 码力 | 1817 页 | 6.19 MB | 1 年前3Django 1.11.x Documentation
database transaction, but only if the transaction successfully commits. Examples might include a Celery task, an email notification, or a cache invalidation. Django provides the on_commit() function to invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) You can also wrap your function in a lambda: transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function transaction, but they are not part of the transaction. For the intended use cases (mail notifications, Celery tasks, etc.), this should be fine. If it’s not (if your follow-up action is so critical that its0 码力 | 2747 页 | 2.67 MB | 1 年前3Django 1.10.x Documentation
database transaction, but only if the transaction successfully commits. Examples might include a Celery task, an email notification, or a cache invalidation. Django provides the on_commit() function to invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) You can also wrap your function in a lambda: transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function transaction, but they are not part of the transaction. For the intended use cases (mail notifications, Celery tasks, etc.), this should be fine. If it’s not (if your follow-up action is so critical that its0 码力 | 2538 页 | 2.59 MB | 1 年前3Django 2.1.x Documentation
database transaction, but only if the transaction successfully commits. Examples might include a Celery task, an email notification, or a cache invalidation. Django provides the on_commit() function to invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) You can also wrap your function in a lambda: transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function transaction, but they are not part of the transaction. For the intended use cases (mail notifications, Celery tasks, etc.), this should be fine. If it’s not (if your follow-up action is so critical that its0 码力 | 2790 页 | 2.71 MB | 1 年前3Django 2.0.x Documentation
database transaction, but only if the transaction suc- cessfully commits. Examples might include a Celery task, an email notification, or a cache invalidation. Django provides the on_commit() function to invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) You can also wrap your function in a lambda: transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function transaction, but they are not part of the transaction. For the intended use cases (mail notifications, Celery tasks, etc.), this should be fine. If it’s not (if your follow-up action is so critical that its0 码力 | 1880 页 | 6.41 MB | 1 年前3Django 2.2.x Documentation
database transaction, but only if the transaction successfully commits. Examples might include a Celery task, an email notification, or a cache invalidation. Django provides the on_commit() function to invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) You can also wrap your function in a lambda: transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function transaction, but they are not part of the transaction. For the intended use cases (mail notifications, Celery tasks, etc.), this should be fine. If it’s not (if your follow-up action is so critical that its0 码力 | 2915 页 | 2.83 MB | 1 年前3Django 2.0.x Documentation
database transaction, but only if the transaction successfully commits. Examples might include a Celery task, an email notification, or a cache invalidation. Django provides the on_commit() function to invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) You can also wrap your function in a lambda: transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function transaction, but they are not part of the transaction. For the intended use cases (mail notifications, Celery tasks, etc.), this should be fine. If it’s not (if your follow-up action is so critical that its0 码力 | 2746 页 | 2.67 MB | 1 年前3Django 2.2.x Documentation
database transaction, but only if the transaction suc- cessfully commits. Examples might include a Celery task, an email notification, or a cache invalidation. Django provides the on_commit() function to django.db import transaction def do_something(): pass # send a mail, invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) 156 Chapter 3. Using Django Django Documentation dev20220411083753 You can also wrap your function in a lambda: transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function you pass in will be called immediately after a hypothetical database0 码力 | 2060 页 | 7.23 MB | 1 年前3
共 20 条
- 1
- 2