Skip to content

Commit

Permalink
Merge pull request #829 from vspiespro/patch-1
Browse files Browse the repository at this point in the history
Update django.rst
  • Loading branch information
coleifer authored Dec 29, 2024
2 parents 327854c + 8902282 commit 5da909a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/django.rst
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,17 @@ Here is the safe version:
Because we have to setup a callback to run after commit, the full functionality
of the :py:class:`TaskWrapper` is not available with tasks decorated with
:py:func:`on_commit_task`. If you anticipate needing all the TaskWrapper
methods, you can decorate the same function twice:
methods, you can decorate the same function twice by given them two different
identifier names:

.. code-block:: python
def do_work(user_id):
user = User.objects.get(pk=user_id)
...
do_work_task = task()(do_work)
do_work_on_commit = on_commit_task()(do_work)
do_work_task = task(name="do_work_task")(do_work)
do_work_on_commit = on_commit_task(name="do_work_on_commit")(do_work)
.. py:func:: on_commit_task(*args, **kwargs)
Expand Down

0 comments on commit 5da909a

Please sign in to comment.